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).

Timo Kör

Thanks, you cannot unset an alias, but a function.

Ahmed ElRefaey

Thanks!

darren

in $HOME/.oh-my-zsh set this value to 1 instead of 0

local disable_aliases=1

sahrul solihin

it works for me. been one year and your comment still usefull for me, thank you so very much brother

Your email will never ever be published.

Related posts