Skip to content

Instantly share code, notes, and snippets.

@vinbarnes
Forked from gnarmis/git-recent-branches
Last active August 29, 2015 14:17
Show Gist options
  • Save vinbarnes/f6ce2d3fd4b44d92bcf3 to your computer and use it in GitHub Desktop.
Save vinbarnes/f6ce2d3fd4b44d92bcf3 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Blame @gnarmis if this doesn't work
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git recent-branches`.
#
# Show top 5 most recent branches:
# $ git recent-branches | head -n 5
#
#
set -e
git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname)' | sed 's/refs\/heads\///g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment