From 627fab4879b9fce0005b18ac528f71c1d1b08609 Mon Sep 17 00:00:00 2001 From: Dillon Flamand Date: Wed, 28 Mar 2018 21:36:53 -0700 Subject: [PATCH] Improve git auto-correct Provide more details for the git feature auto-correct. --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a5c01cb..3c354be 100644 --- a/README.md +++ b/README.md @@ -974,7 +974,9 @@ Some useful aliases include: *Some Aliases are taken from [@mathiasbynens](https://github.com/mathiasbynens) dotfiles: https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig* #### Auto-Correct -If you type `git comit` you will get this: +Git gives suggestions for misspelled commands and if auto-correct is enabled the command can be fixed and executed automatically. Auto-correct is enabled by specifying an integer which is the delay in tenths of a second before git will run the corrected command. Zero is the default value where no correcting will take place, and a negative value will run the corrected command with no delay. + +For example, if you type `git comit` you will get this: ```bash $ git comit -m "Message" @@ -984,21 +986,23 @@ $ git comit -m "Message" # commit ``` -To call `commit` when `comit` is typed, just enable auto-correct: +Auto-correct can be enabled like this (with a 1.5 second delay): ```bash -$ git config --global help.autocorrect 1 +$ git config --global help.autocorrect 15 ``` -So now you will get this: +So now the command `git comit` will be auto-corrected to `git commit` like this: ```bash $ git comit -m "Message" # WARNING: You called a Git command named 'comit', which does not exist. # Continuing under the assumption that you meant 'commit' -# in 0.1 seconds automatically... +# in 1.5 seconds automatically... ``` +The delay before git will rerun the command is so the user has time to abort. + #### Color To add more color to your Git output: