Skip to content
Tags

Git: List Recently Active Branches

by on July 9, 2013

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

where 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

Links

From → Dev, Tips & Tricks

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s