首页 > 其他 > 详细

git别名设置

时间:2021-01-19 09:22:11      阅读:21      评论:0      收藏:0      [点我收藏+]

$ 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 config --global alias.last ‘log -1 HEAD‘

$ git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"

 

 
  • 这意味着,当要输入 git commit 时,只需要输入 git ci。 随着你继续不断地使用 Git,可能也会经常使用其他命令,所以创建别名时不要犹豫。
  • 通常也会添加一个 last 命令,像这样:
    $ git config --global alias.last ‘log -1 HEAD‘

    这样,可以用git last命令轻松地看到最后一次提交

  •  个人习惯添加了一个git tree和 git hist(两个其实指向一个指令)
    •   

      $ git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"

      $ git config --global alias.hist "log --graph --decorate --pretty=oneline --abbrev-commit"   


 直接修改用户下的.gitconfig文件也可以,其中alias一项为:
[alias]
    co = checkout
    br = branch
    ci = commit
    st = status
    tree = log --graph --decorate --pretty=oneline --abbrev-commit
    hist = log --graph --decorate --pretty=oneline --abbrev-commit
    last = log -1 HEAD

 

git别名设置

原文:https://www.cnblogs.com/Jacck/p/14296133.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!