Skip to content

Instantly share code, notes, and snippets.

@robert-skarzycki
Last active January 16, 2020 09:26
Show Gist options
  • Save robert-skarzycki/9f3f736df00ff1c6181b337d224c207e to your computer and use it in GitHub Desktop.
Save robert-skarzycki/9f3f736df00ff1c6181b337d224c207e to your computer and use it in GitHub Desktop.
Git commands

Show last few comments

git log HEAD~10..HEAD

List recently modified branches

git for-each-ref --count=50 --sort=-committerdate refs/heads/ --format="%(refname:short) [%(color:green)%(committerdate:relative)%(color:reset)]"

List merges with only commit message

git log --merges --pretty=%s

Remove branches that are no longer on remote

git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
  • works in bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment