Git autocorrect

Did you know that there is an autocorrect feature within git? It automatically correct (and execute) things like git stats to git status. By default this feature is disabled. To enable it enter the following command:

$ git config --global help.autocorrect -1

From the documentation:

Automatically correct and execute mistyped commands after waiting for the given number of deciseconds (0.1 sec). If more than one command can be deduced from the entered text, nothing will be executed. If the value of this option is negative, the corrected command will be executed immediately. If the value is 0 - the command will be just shown but not executed. This is the default.

So if you want to have a chance to cancel it, just use a value like 20 which gives you 2 seconds to react and cancel the command.

comments powered by Disqus