• Git 系列教程(10)- 仓库别名


    Git 别名

    前言

    Git 并不会在你输入部分命令时自动推断出你想要的命令

    如果不想每次都输入完整的 Git 命令,可以通过 git config 文件来轻松地为每一个命令设置一个别名

    $ git config --global alias.co checkout
    $ git config --global alias.br branch
    $ git config --global alias.ci commit
    $ git config --global alias.st status

    这意味着,当要输入 git commit 时,只需要输入 git ci

    为了解决取消暂存文件的易用性问题,可以向 Git 中添取消暂存别名

    $ git config --global alias.unstage 'reset HEAD --'

    这会使下面的两个命令等价:

    $ git unstage fileA
    $ git reset HEAD -- fileA

    通常也会添加一个 last 命令

    $ git config --global alias.last 'log -1 HEAD'

    这样,可以轻松地看到最新一次提交历史

    $ git last
    commit 66938dae3329c7aebe598c2246a8e6af90d04646
    Author: Josh Goebel <dreamer3@example.com>
    Date:   Tue Aug 26 19:48:51 2008 +0800
    
        test for current head
    
        Signed-off-by: Scott Chacon <schacon@example.com>
     
  • 相关阅读:
    SHELL[22]
    SHELL[15]
    SHELL[08]
    SHELL[12]
    SHELL[06]
    SHELL[24]
    SHELL[11]
    shell文件合并、去重
    SHELL[25]
    SHELL[14]
  • 原文地址:https://www.cnblogs.com/poloyy/p/14774967.html
Copyright © 2020-2023  润新知