How to unset aliases set by Oh My Zsh

14 June 2018   1 comment   Linux, MacOSX

I use Oh My Zsh and I highly recommend it. However, it sets some aliases that I don't want. In particular, there's a plugin called git.plugin.zsh (located in ~/.oh-my-zsh/plugins/git/git.plugin.zsh) that interfers with a global binary I have in $PATH. So when I start a shell the executable gg becomes...:

▶ which gg
gg: aliased to git gui citool

That overrides /usr/local/bin/gg which is the one I want to execute when I type gg. To unset that I can run...:

unset gg

▶ which gg
/usr/local/bin/gg

To override it "permanently", I added, to the end of ~/.zshrc:

# This unsets ~/.oh-my-zsh/plugins/git/git.plugin.zsh
# So my /usr/local/bin/gg works instead
unalias gg

Now whenever I start a new terminal, it defaults to the gg in /usr/local/bin/gg instead.

Comments

Michael

Thank you for this!

I was trying to do the same thing with a different command (git push), and at first "unalias" wasn't working, but I didn't want to put it at the end of my .zshrc because then it would be far from the point where the alias is set.

As it turns out, the call to unalias merely has to be after "source $ZSH_DIR/oh-my-zsh.sh", because that is when the plugins are loaded (and the aliases set up).

Your email will never ever be published

Related posts

Previous:
How to NOT start two servers on the same port 11 June 2018
Next:
The best grep tool in the world; ripgrep 19 June 2018
Related by Keyword:
How I found out where a bash alias was set up 09 May 2018
gg - A prototype to rule Git, GitHub and Bugzilla 06 May 2016
gg - wrapping git-grep 11 August 2009
www aliases set up 01 November 2005