Take the 2-minute tour ×

Sometimes I mistype what I actually mean:

whunt$ git statsu
git: 'statsu' is not a git command. See 'git --help'.

Did you mean this?

You can tell git to just do what it suggests by changing help.autocorrect in your git config. But sometimes I mistype destructive actions that I'd rather not have git automatically run for me:

whunt$ git checkoot some/file
git: 'checkoot' is not a git command. See 'git --help'.

Did you mean this?

So really, instead of running what it thinks I want, I'd rather have git tell me the status when it doesn't understand the command. Does anyone know how to do this?

share|improve this question
Are you saying you mistyped checkoot when you actually meant, say, branch? Come on, is there an example where a non-destructive command, mistyped, becomes a destructive one because of autocorrect? –  manojlds Mar 13 '13 at 16:05
That's not the point. I want the ease of mind for knowing I can't accidentally ruin something with git. Letting git automatically run commands that I didn't specify directly (even if nothing was ambiguous) worries me. Ideally I'd like to run a callback function when git doesn't understand the input. That would be useful even if you don't agree with this example. –  wesdotcool Mar 13 '13 at 16:23
Just don't allow autocorrect. Otherwise what you want is, for every typo, run command X - always command X - always. That would piss me off pretty fast (and make me turn autocorrect off) –  KevinDTimm Mar 13 '13 at 16:45

2 Answers 2

Aside from Billy's shell aliases, if you prefer, you can also create aliases in git itself.

git config --global alias.statsu status
git config --global alias.checkoot checkout

You make it sound like you tend to make the same typos, so perhaps exhaustively creating aliases for them isn't too inconvenient or unrealistic.

share|improve this answer

Use alias.

I'm using zsh, just add following to ~/.zshrc. Or to ~/.bashrc if using Bash only.

alias gs = 'git status'

Now you can blame your keyboard if still typo.


Here are all my git alias to avoid you guys more typo :)

alias gs="git status"
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gcm='git commit -m'
alias gd='git diff'
alias go='git checkout '
alias gh='git hist'
alias gk='gitk --all&'
alias gx='gitx --all'
share|improve this answer
How does this solve the problem of typing git checkoot? –  KevinDTimm Mar 13 '13 at 17:43
@KevinDTimm, I added more alias. –  Billy Chan Mar 14 '13 at 1:26

Your Answer


