How can I delete a git alias?

30,543

Solution 1

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

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

Or just:

vim ~/.gitconfig

And delete the alias lines.

Solution 4

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

git config --global --unset alias.YourAlias
Share:
30,543
Daydreaming Duck
Author by

Daydreaming Duck

Updated on July 28, 2022

Comments

  • Daydreaming Duck
    Daydreaming Duck almost 2 years

    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?

  • joel
    joel over 5 years
    is this fragile to implementation changes?
  • atupal
    atupal over 5 years
    @JoelBerkeley Yes. And just provide another way. :-)
  • De Novo
    De Novo about 5 years
    In addition to being the correct way to do this, this solution has the benefit of working for local and system aliases, as well as global aliases, provided you use the appropriate flag (--local, etc).