Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thushan/9318086 to your computer and use it in GitHub Desktop.
Save thushan/9318086 to your computer and use it in GitHub Desktop.
List remote Git branches and the last commit date & user for each branch. Sorted by most recent commit date.
# Credit http://stackoverflow.com/a/2514279 && https://gist.github.com/jasonrudolph/1810768
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci\t%cr\t%an" $branch | head -n 1` \\t$branch; done | sort -r
# See https://www.kernel.org/pub/software/scm/git/docs/git-show.html for other data
# Example output (resulting from running command on the Rails repo — https://github.com/git-tfs/)
2014-01-18 03:42:25 -0800 6 weeks ago Matt Burke origin/master
2013-11-01 11:47:57 +0800 4 months ago Sean M. Collins origin/issue_474
2013-06-14 02:49:34 -0400 9 months ago Matt Burke origin/lightfoot
2013-06-08 08:01:43 -0400 9 months ago Matt Burke origin/alternate-cleanup-implementations
2013-06-08 08:00:07 -0400 9 months ago Matt Burke origin/time-since-start
2013-06-08 07:48:25 -0400 9 months ago Matt Burke origin/debug_slow_commit
2013-02-25 13:00:19 -0500 1 year ago Matt Burke origin/rename-should-not-delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment