Skip to content

Instantly share code, notes, and snippets.

@nadeem-khan
Last active December 9, 2016 11:53
Show Gist options
  • Save nadeem-khan/9ece50ad4a037a6f5065 to your computer and use it in GitHub Desktop.
Save nadeem-khan/9ece50ad4a037a6f5065 to your computer and use it in GitHub Desktop.
Git Commands
git log -n 2
git log --since=2012-06-15
git log --until=2012-06-15
git log --author="Nadeem"
git log --oneline
git log SHA1..SHA2 --oneline
git log SHA..index.html
git log --format=short
git show SHA
git show --format=online HEAD
git diff -b SHA1.HEAD (-b for ignoring spaces ... -w for ignoring all spaces)
git diff
git commit -am "when editing the most recent commit message"
cd .git/refs/heads then cat master (HEAD POINTER)
git diff --color-words index.php
git revert SHA
git reset --soft (--mixed OR --hard)
git clean -n
git clean -fd (force all files to get trashed that aren't tracked)
git rm --cached file.txt (keeps in working copy, all others deleted and stops tracking it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment