I recently moved from bash to zsh. Everything is great, I love it! Except some of my old aliases are getting confused. I have a long list of aliases like this that I've just migrated wholesale from .bash_profile to .zshrc:

alias grc="git rebase --continue"
alias gpu="git pull"
alias gac="git commit -am "
alias gbD="git branch -D"
alias gcm="git commit -m "
alias gA="git add -A"
alias gC="git checkout"
alias ga="git add"
alias gd="git diff"
alias gm="git merge"
alias gr="git rebase"
alias gc="git commit"
alias gb="git branch"
alias gs="git status"
alias gp="git push"

The problem is that some of the three-letter aliases, like gcm are getting confused because they're prefixed with another two-letter alias. This was fine on bash, but zsh seemingly gets confused, so when I try gcm "My commit message" I get an error like error: pathspec 'My commit message' did not match any file(s) known to git.

I've tried changing the order the aliases are defined but that's not fixed it. Is there any way around this? I've got about a decade of muscle-memory invested in this config...

  • Cannot replicate. Invoke set -x and try again to check what the command really is. Are you sure your aliases are not overwritten by something? E.g. this site mentions some template aliases related to git and they are different than yours. Feb 4, 2020 at 16:13
  • I installed the globalias plugin, and something odd is happening, gcm is expanded to git commit master - so nothing to do with my aliases at all. Now I'm trying to work out where this expansion is happening. Feb 4, 2020 at 16:23

1 Answer 1


Ok, it turns out the git plugin, which is enabled by default specifies its own conflicting set of aliases. It doesn't seem to do anything else I'm interested in, so I've disabled it and it's now fine.

Alternatively make sure custom aliases are defined in .zshrc after oh-my-zsh is initialised.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .