gitautocorrect

How do I turn off git autocorrect?


When I typo a git command, such as typing git git checkout myfile (note the extra "git") I get the following output:

WARNING: You called a Git command named 'git', which does not exist.
Continuing under the assumption that you meant 'init'
in 0.1 seconds automatically...
usage: git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]

So git assumes I meant init, and gives me all of 0.1 seconds to see the mistake before it moves forward. Not cool git!

How do I turn this "feature" off?


Solution

  • To see the setting of autocorrect, type:

    git config help.autocorrect

    Per the docs:

    help.autocorrect is actually an integer which represents tenths of a second. So if you set it to 50, Git will give you 5 seconds to change your mind before executing the autocorrected command.

    To turn this off, use the command:

    git config --global help.autocorrect 0