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.

Previous:
How to NOT start two servers on the same port June 11, 2018 Linux, Web development
Next:
The best grep tool in the world; ripgrep June 19, 2018 Linux, Web development, macOS
Related by category:
fnm is much faster than nvm. December 28, 2023 macOS
set -ex - The most useful bash trick of the year August 31, 2014 Linux
Be careful with Date.toLocaleDateString() in JavaScript May 8, 2023 macOS
brotli_static in Nginx November 8, 2024 Linux
Related by keyword:
The correct way to index data into Elasticsearch with (Python) elasticsearch-dsl May 14, 2021 Python, MDN, Elasticsearch
gg - A prototype to rule Git, GitHub and Bugzilla May 6, 2016 Python, Web development
gg - wrapping git-grep August 11, 2009 Linux
How I found out where a bash alias was set up May 9, 2018 Linux