Last Updated: February 25, 2016
·
470
· sethunath

Git Cheatsheet

  • git commit - commits the changes
  • git commit -m "test" - adds the message and commit
  • git commit -a - adds the file and commits
  • git commit --amend edit the previous commit

  • git status - shows the current status

  • git show --pretty="format:" --name-only bd61ad98 - which files were changed in last commit

  • git diff - shows the diff between the current working directory and staged data

  • git diff --cached - shows the diff between the current staged data and revision head

  • git diff 48c27fe78c49080464cf449cb5cc80a0654b42e - shows the diff between the current working data and a particular revision

  • git diff --cached e48c27fe78c49080464cf449cb5cc80a0654b42e - shows the diff between the current staged data and a particular revision

  • git diff ID1 ID2 - diff between two revisions

  • git log - shows a log

  • git log --graph - shows a graphical log

  • git log boilerplate.html - shows log for a file

  • git log -p boilerplate.html - shows log with patches

  • git rm - removes a file from git being tracked

  • git rm --cached - removes a file from staging area

  • git reset - Resets the staged data or unstages all staged files

  • git blame boilerplate.html - who changed what and when