/ technical

Useful Git commands

Git Log

This is a note to myself for some useful/often used git commands.

  • git checkout -
  • git clean -fdn
  • git reset <commit>
  • git reset --soft HEAD~1
  • git rebase -i <commit>
  • git diff HEAD^1
  • git diff --staged or git diff --cached
  • git diff develop master
  • git log -p
  • git log --all --grep='keyword'
  • git remote prune origin or git fetch --prune
  • git rebase --autosquash

HEAD~1 means commit's first parent
HEAD^1 means commit's first parent
HEAD~2 means commit's first parent's first parent
HEAD^2 means commit's second parent

references:

http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde