I use git all day, every day. I also created a lot of small feature branches. It’s really useful for me to quickly see the most recent branches I’ve been working in. This reminds me which branch I should check out for a change.

I added a little alias to my .zshrc file that looks like this:

alias grecent='git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"'

This shows the most recent 10 branches. You can easily tweak that number. In my terminal, if do the following:

\$ grecent

I see this for a project with only three branches:

See the most recent 10 active git branches