How can I delete a git alias?

GitAlias

Git Problem Overview


I'm learning to work with git, and I tried to set some aliases like this:

git config --global alias.trololo 'status'

So now when I type git trololo it works like git status.

Now trololo alias is not needed. How can I correctly delete it?

Git Solutions


Solution 1 - Git

You can try --unset in git config:

git config --global --unset alias.trololo

I find it safer than editing directly the config file (git config --global --edit)

Solution 2 - Git

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

git config --global --unset-all

Solution 3 - Git

Or just:

vim ~/.gitconfig

And delete the alias lines.

Solution 4 - Git

You can remove it by deleting that line from the configuration file or you can try this:

git config --global --unset alias.YourAlias

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDaydreaming DuckView Question on Stackoverflow
Solution 1 - GitVonCView Answer on Stackoverflow
Solution 2 - GitEdhrendalView Answer on Stackoverflow
Solution 3 - GitatupalView Answer on Stackoverflow
Solution 4 - GitCoder PandaView Answer on Stackoverflow