Git – Autocorrect spelling

Git is but of course one of the most powerful DVCS client and it is used by millions of developers worldwide. Git do provides a lots of features to work with different versions of your software. Some of those features are well known but others are not that much popular. One of such non popular feature is Git Autocorrect.

Git do have capability to check whether the commands you are firing at git console are correct or not. If the commands are not correct then Git can suggest you corrections. In fact git can auto correct your wrong command.

Let’s take an example. You are in hurry and you misspelled “Git Push” as

git pusj

and pressed enter. Git will generate following error message…

git: ‘pusj’ is not a git command. See ‘git –help’.
Did you mean this? push

and will wait for your input.

Have you noticed? Git suggested perfect command, “Push”. Check the second line.

You can configure Git to take correct action even though you misspelled the commands by using Git autocorrect. To enable Git autocorrect, just type following on git console and press Enter.

git config --global help.autocorrect 1

This will enable auto correct in Git. Now if you try to run that “Git Pusj” command, instead of giving suggestion, git will give following message…

WARNING: You called a Git command named ‘pusj’, which does not exist. Continuing under the assumption that you meant ‘push’ in 0.1 seconds automatically..

and will execute the “Git Push” Command.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.