How to autocorrect Git commands

Learn how to turn on and off Git autocorrection feature
Published 2023-03-201 min read
How to autocorrect Git commands

If you often mistype Git commands you may find it useful to set up Git to autocorrect them for you. This feature is built-in and available with a simple setup - changing help.autocorrect is all you need.

To enable autocorrect

Type in your command line:

git config --global help.autocorrect 1

From now on your typos will be automatically corrected after 1 * 100ms :

> git statwo                            
WARNING: You called a Git command named 'statwo', which does not exist.
Continuing in 0.1 seconds, assuming that you meant 'status'.

You can increase this time, by changing the number, for example, to autocorrect after 2,5s you should type:

git config --global help.autocorrect 25


To disable autocorrect

To disable it just set the number to 0:

git config --global help.autocorrect 0



Unfortunately, this feature is quite limited and inaccurate when guessing ambiguous commands. Also, it won’t work if you make too many errors.

> git stat                              
git: 'stat' is not a git command. See 'git --help'.

The most similar commands are

Anyway, my recommendation would be to set it up and forget it.

Tags: #git #cli