Git

Reset

Undoing a Commit

git reset HEAD~

Look at local Git activity

git reflog

Reset to a specific HEAD

git reset –hard HEAD@{$1}

  • $1 = Reflog Count (top to bottom)

Author

Commit count by Author

git shortlog -s -n –all

Commits of Author

git log –author=$1

  • $1 = Author Name

Hash

Last commit hash (Short)

git rev-parse –short HEAD

Last commit hash (Long)

git rev-parse HEAD

Other

Pick and Sign

git cherry-pick $1 git commit –amend –signoff -s

  • $1 = Commit Hash

Patches from History

git format-patch -$1 HEAD

  • $1 = Amount

Auto Rebase on Pull

git config –global pull.rebase true