如何删除 git 别名?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23512402/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I delete a git alias?
提问by Daydreaming Duck
I'm learning to work with git, and I tried to set some aliases like this:
我正在学习使用 git,并尝试设置一些这样的别名:
git config --global alias.trololo 'status'
So now when I type git trololo
it works like git status
.
所以现在当我输入git trololo
它时就像git status
.
Now trololo alias is not needed. How can I correctly delete it?
现在不需要 trololo 别名。我怎样才能正确删除它?
回答by VonC
You can try --unset
in git config
:
您可以尝试--unset
在git config
:
git config --global --unset alias.trololo
I find it safer than editing directly the config file (git config --global --edit
)
我发现它比直接编辑配置文件更安全 ( git config --global --edit
)
回答by Edhrendal
In case someone has multiple values for the same alias and has got that:
如果有人对同一个别名有多个值并且已经得到:
$ git config --global --unset alias.trololo
warning: alias.trololo has multiple values
Use --unset-all
用 --unset-all
git config --global --unset-all
回答by atupal
Or just:
要不就:
vim ~/.gitconfig
And delete the alias lines.
并删除别名行。
回答by Coder Panda
You can remove it by deleting that line from the configuration file or you can try this:
您可以通过从配置文件中删除该行来删除它,或者您可以尝试以下操作:
git config --global --unset alias.YourAlias