我想用git创建别名,这样就可以有像gitxxx这样的东西:
例如,而不是:
git statut我想要
gits提前谢谢你。
发布于 2015-07-09 20:29:08
发布于 2015-07-09 20:36:40
您需要使用shell别名。
像alias gits='git status'这样的东西
[projects/iadmin] gits (git-svn)-[master]
zsh: command not found: gits
[projects/iadmin] alias gits='git status' (git-svn)-[master]
[projects/iadmin] gits (git-svn)-[master]
On branch master
nothing to commit, working directory clean这假设了一个类似于*nix的环境和基于sh的shell。但正如其他人指出的那样,您不能使用内部git别名,因为您仍然需要使用git作为前缀。
我还使用shell函数来实现其中的一些功能。
从我的zshrc
# No arguments: `git status`
# # With arguments: acts like `git`
g() {
if [[ $# > 0 ]]; then
git $@
else
git status
fi
}https://stackoverflow.com/questions/31317448
复制相似问题