Fri 11 Nov 2022
List your Git branches by recent activity
SHARE THIS POST
Sometimes you just want to see your most recent branches. Here's a handy Git alias that will help you do just that.
Even if you’re diligent and regularly delete merged and stale branches you may still find it hard to pick out a particular branch from the alphabetically-sorted output of git branch. How about something more useful, like seeing them listed based on their freshness?
The git branch command accepts a --sort option which we can use to list our branches based on the last committer date:
$ git branch --sort=-committerdate * main redact-abandoned log-downloads i18n-lint