Skip to content

Instantly share code, notes, and snippets.

@andrewchilds
Created February 18, 2016 17:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewchilds/d056bdd49cda367c3a75 to your computer and use it in GitHub Desktop.
Save andrewchilds/d056bdd49cda367c3a75 to your computer and use it in GitHub Desktop.
A more GitHub-like `git branch`
#!/bin/sh
# gitbr
#
# Example output:
#
# $ gitbr
#
# 3 months ago ac/1999/labels-redesign-spike
# 745f166 WIP.
#
# 2 months ago ac/2183/use-search-endpoint-on-epics-page
# 2311ea8 WIP.
#
# 22 days ago ac/2963/drag-and-drop-refactor
# 5503b77 WIP.
#
# 14 hours ago master
# 431319b Fix Zendesk #123
#
function gitbr {
git for-each-ref --sort=committerdate refs/heads/ \
--format='%(color:green)%(committerdate:relative) AWK_PIPE %(color:reset)%(refname:short) AWK_PIPE %(color:yellow)%(objectname:short) %(color:blue)%(contents:subject)' \
| awk 'BEGIN { FS = " AWK_PIPE " } ; { printf "\n%-19s %s\n %s\n", $1, $2, $3 }'
}
@paulirish
Copy link

screenshot
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment