Skip to content

Instantly share code, notes, and snippets.

@safhac
Created October 19, 2020 17:48
Show Gist options
  • Save safhac/686fefc82a397d4ef8d46de3bf9110a8 to your computer and use it in GitHub Desktop.
Save safhac/686fefc82a397d4ef8d46de3bf9110a8 to your computer and use it in GitHub Desktop.
git cheat sheet
# uncommited file to HEAD
git diff <path>
# uncommited file to before last commit
git diff HEAD^ -- <path>
#last commit to before last commit
git diff HEAD^ HEAD -- <path>
#difference between HEAD and n-th grandparent
git diff HEAD~n HEAD -- <path>
#Another cool feature is whatchanged command
git whatchanged -- <path>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment