Git: List Recently Active Branches
I just had the problem that I knew that a colleague pushed a feature branch I want to check out. But I did not know the name of the feature branch. After a short reasearch I built a git command line using for-each-ref:
$ git for-each-ref \ --sort=-committerdate \ --format='%(refname) by %(authoremail)' \ --count=10 \ refs/heads refs/remotes
refs/heads is for local changes and
refs/remotes is for remote changes (obviously the last one would have been sufficient for my use-case).
I like the command that much that I added it to my
.gitconfig file as alias recent:
[alias] recent = for-each-ref --sort=-committerdate --format='%(refname) by %(authoremail)' --count=10 refs/heads refs/remotes