Git Branch Time

Heres a small script from Ben Hoskings which is immensely useful. It lists all the branches in your git project ordered by when you last worked on them. It also highlights branches which have not yet been merged into your current branch, which is super useful when looking to prune some branches.

Heres how it looks on the rails repo:

From a quick glance at that you can see what has been merged in (gray SHA) and what wasn't merged into the current branch (yellow SHA with a +). You can also get a good overview of where certain branches stand based off their age.

Heres the gist. (I take no credit for this, but it is useful enough to share)

After adding that alias you can then go into your project and run git brt or git brt -a to get the listing. It accepts (most) switches you can pass to git branch.