Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active February 19, 2017 12:45
Show Gist options
  • Save nepsilon/07012e437f419c680211 to your computer and use it in GitHub Desktop.
Save nepsilon/07012e437f419c680211 to your computer and use it in GitHub Desktop.
5 tips to show (once again) that Git is amazing — First published in fullweb.io issue #21

5 tips to show (once again) that Git is amazing:

1. Fetch a file from another branch without changing your current branch:

$ git checkout other_branch -- path/to/file 

2. See what branches are merged:

$ git checkout master 
$ git branch --merged

Use --no-merged to see the branches not yet merged.

3. Have Git auto-correct you:

$ git config --global help.autocorrect 1

Example:

$ git commti 
WARNING: You called a Git command named 'commti', which does not exist. 
Continuing under the assumption that you meant 'commit'

4. Show word changes in diff:

$ git diff --word-diff 

5. Set remote branch tracking by default:

$ git config --global push.default tracking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment