AutoCorrect in Git

I can’t believe autocorrect is available, or that I didn’t know it existed. I should have looked, after all, git is smart enough to guess my intentions. I learned this from Kendra Little, who made a quick video on this. She got it from Andy Carter’s blog.

Let’s say that I type something like git stats in the cmd line. I’ll get a message from git that this isn’t a command, but there is one similar. You can see this below.

2020-12-04 11_32_06-cmd (Admin)

However, I can have git actually just run this. If I change the configuration with this code:

git config --global help.autocorrect 20

Now if I run the command, I see this, where git will delay briefly and then run what it things is correct.

2020-12-04 11_34_45-cmd (Admin)

The delay is controlled by the parameter I passed in. The value in in tenths of a second, so 20 is 2 seconds, 50 is 5 seconds, 2 is 0.2 seconds, etc.  If you set this back to 0, autocorrect is off.

A great trick, and one I’d suggest everyone enable.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.

3 Responses to AutoCorrect in Git

  1. brianary says:

    Configuring tab completion so you don’t misspell things in the first place is even nicer!
    https://www.hanselman.com/blog/command-line-tab-completion-for-net-core-cli-in-powershell-or-bash

    Like

  2. way0utwest says:

    That’s cool! I don’t use the dotnet cli, but I’ll keep this in mind.

    Like

Comments are closed.