8000 Merge pull request #186 from dflamand/master · nirajkvinit/github-cheat-sheet@0a4d907 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a4d907

Browse files
authored
Merge pull request tiimgreen#186 from dflamand/master
Improve git auto-correct
2 parents 7853230 + 627fab4 commit 0a4d907

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,9 @@ Some useful aliases include:
974974
*Some Aliases are taken from [@mathiasbynens](https://github.com/mathiasbynens) dotfiles: https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*
975975

976976
#### Auto-Correct
977-
If you type `git comit` you will get this:
977+
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.
978+
979+
For example, if you type `git comit` you will get this:
978980

979981
```bash
980982
$ git comit -m "Message"
@@ -984,21 +986,23 @@ $ git comit -m "Message"
984986
# commit
985987
```
986988

987-
To call `commit` when `comit` is typed, just enable auto-correct:
989+
Auto-correct can be enabled like this (with a 1.5 second delay):
988990

989991
```bash
990-
$ git config --global help.autocorrect 1
992+
$ git config --global help.autocorrect 15
991993
```
992994

993-
So now you will get this:
995+
So now the command `git comit` will be auto-corrected to `git commit` like this:
994996

995997
```bash
996998
$ git comit -m "Message"
997999
# WARNING: You called a Git command named 'comit', which does not exist.
9981000
# Continuing under the assumption that you meant 'commit'
999-
# in 0.1 seconds automatically...
1001+
# in 1.5 seconds automatically...
10001002
```
10011003

1004+
The delay before git will rerun the command is so the user has time to abort.
1005+
10021006
#### Color
10031007
To add more color to your Git output:
10041008

0 commit comments

Comments
 (0)
0