152

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?

Coder Panda
  • 632
  • 3
  • 9
  • 31
Daydreaming Duck
  • 2,110
  • 3
  • 18
  • 25

5 Answers5

223

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)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    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). – De Novo Feb 14 '19 at 20:25
35

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
Ferdi
  • 540
  • 3
  • 12
  • 23
Edhrendal
  • 582
  • 8
  • 17
17

Or just:

vim ~/.gitconfig

And delete the alias lines.

atupal
  • 16,404
  • 5
  • 31
  • 42
6

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

git config --global --unset alias.YourAlias
Coder Panda
  • 632
  • 3
  • 9
  • 31
0

You can manually remove it in your global settings files by:

  • Running git config --global -e
  • Locate the alias in the opend global settings file.
  • Erase it, and save the file.
Eliya
  • 40
  • 8