[英]How to rename git commands
我想重命名以下git命令:
而不是输入:
git checkout
我想将其重命名为git co
。
git commit
我想将其重命名为git cm
。
git push origin
我想将其重命名为git po
。
我怎样才能做到这一点?
谢谢!
您要做的就是为$ shell(bash / csh / zsh / fish)创建所谓的“别名”。
试试这个著名的大卫·沃尔什的出色博客文章: https : //davidwalsh.name/alias-bash
但请注意:通过ssh在远程计算机上工作或切换计算机时,非标准别名会让您大失所望,如果您在脚本中使用别名,它们将不会在其他地方运行!
使用别名: 这是显示其工作原理的链接 。
您可以在.bash_profile
文件中放入以下内容:
alias checkout='git checkout'
alias pull='git pull'
alias push='git push origin'
alias push_f='git push origin -f'
alias rebase='git rebase'
#...
然后source .bash_profile
现在您可以编写: checkout master
, push master
, checkout master
注意:声明别名时不能放置参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.