Sometimes I work on a few branches at the same time.
Emergency bug fix branch here, new feature branch there, performance update branch here, update gem branch there, etc…
Within a big project we sometimes have almost 40 branches at any one time.
So, being human I forget the name of the branch that I was working on last week, and also would like to clean up old branches that I no longer need.
So the solution git for-each-ref
Include a sort and formatting that includes last commit date, and author name. This is the command:
git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short) %(committerdate) %(authorname)'