Skip to content

Instantly share code, notes, and snippets.

@valtoni
Forked from l15n/git-branches-by-commit-date.sh
Created September 2, 2016 18:46
Show Gist options
  • Save valtoni/9c4a691f8911b456b3230e28655dc28e to your computer and use it in GitHub Desktop.
Save valtoni/9c4a691f8911b456b3230e28655dc28e to your computer and use it in GitHub Desktop.
List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r
# Example output (resulting from running command on the Rails repo — https://github.com/rails/rails)
2012-06-20 14:21:23 -0700 3 weeks ago by Aaron Patterson origin/master
2012-06-17 01:23:02 -0700 4 weeks ago by José Valim origin/3-2-stable
2012-06-15 20:36:09 +0200 4 weeks ago by Piotr Sarnacki origin/actionview-extraction
2012-06-14 10:55:30 -0700 4 weeks ago by Aaron Patterson origin/3-1-stable
2012-06-12 20:05:46 -0700 4 weeks ago by Aaron Patterson origin/3-0-stable
2012-05-29 10:40:14 +0200 6 weeks ago by Piotr Sarnacki origin/cat-gemfile-test
2012-05-27 14:01:44 +0200 7 weeks ago by Piotr Sarnacki origin/helpers-order-fixes
2012-05-27 01:47:37 +0200 7 weeks ago by Piotr Sarnacki origin/possible-railties-fix
2012-03-29 06:26:32 -0700 4 months ago by Xavier Noria origin/2-3-stable
2012-03-02 15:01:20 +0100 4 months ago by Sergey Nartimov + José Valim origin/opt_routes
2011-11-25 09:49:54 +0000 8 months ago by José Valim origin/serializers
2011-06-16 12:08:26 -0700 1 year, 1 month ago by wycats origin/compressor
2011-05-24 16:03:41 -0700 1 year, 2 months ago by wycats origin/sass-cleanup
2011-01-13 15:42:28 +1300 1 year, 6 months ago by Michael Koziarski origin/2-1-stable
2011-01-13 15:33:38 +1300 1 year, 6 months ago by Michael Koziarski origin/2-2-stable
2010-08-17 17:11:17 -0700 1 year, 11 months ago by Aaron Patterson origin/deps_refactor
2010-05-16 15:20:52 -0300 2 years, 2 months ago by Santiago Pastorino origin/encoding
2009-09-09 22:25:23 -0700 2 years, 10 months ago by Beau Harrington origin/2-0-stable
2008-02-19 02:09:55 +0000 4 years, 5 months ago by Jeremy Kemper origin/1-2-stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment