Useful Git Commands

Get Commits Between Dates

git log --after="2018-06-30" --before="2018-07-03" --oneline

Get {author}’s Branches

git for-each-ref --format=' %(authorname) %09 %(refname)' --sort=authorname | grep '{author}'

Get Commits Ordered by Commit Date Across Branches

git for-each-ref --sort=-committerdate refs/heads/ \
  --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - \
  %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - \
  %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

Rename branch (Local and Remote)

git branch -m new-name # Use git branch -m old-name new-name if renaming from a different branch

git push origin :old-name new-name

git push origin -u new-name

Commit Stats (Ordered by most-committed 😂 author)

git shortlog -s -n

view raw

hosted with ❤ by GitHub