Skip to content

Instantly share code, notes, and snippets.

@lbjay
Created July 22, 2011 13:39
Show Gist options
  • Save lbjay/1099478 to your computer and use it in GitHub Desktop.
Save lbjay/1099478 to your computer and use it in GitHub Desktop.
list branches based on modtime
Have you wished you could see your branches listed by how recently you
worked on them? I often do. I get lazy and end up with a lot of things
called 'test1...N' or sometimes when I'm working with other people, I
lose track of which branch is their version of a thing and which is my
version.
This handy shell alias (stick it in your ~/.bashrc) can help. Thanks Jan!
{{{
alias gitd='git for-each-ref --format="%(committerdate:short):
%(refname)" --sort=committerdate refs/heads/'
}}}
For example:
$ gitd
2010-02-02: refs/heads/jrbl-fixing-tests
2010-02-09: refs/heads/new-beta-format
2010-02-09: refs/heads/new-beta-branch
2010-02-17: refs/heads/regression-tests
2010-02-17: refs/heads/config-local
2011-07-13: refs/heads/easy_search_fix
2011-07-13: refs/heads/master
2011-07-14: refs/heads/fix-773y-date-format
2011-07-19: refs/heads/test3
2011-07-19: refs/heads/test5
^------this means test5 is my most recent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment