My bash alias:

alias git-recent-branch-work="git for-each-ref --count=30 --sort=committerdate refs/heads/ --format='%(refname:short)'"

Is even better as a native git alias and really easy to set up. In ~/.gitconfig:

  recent-branch-work = for-each-ref --count=30 --sort=-committerdate --format='%(refname:short)' refs/heads/

Or if you don’t want to touch an editor, just call:

git config --global alias.recent-branch-work "for-each-ref --count=30 --sort=committerdate refs/heads/ --format='%(refname:short)'"

so now I call git recent-branch-work to see what branch I was most recently working on.

In all my time using git I hadn’t realised it was so easy to set up these kinds of git subcommands. Definitely a case of RTFM!