Last active
December 25, 2015 15:39
-
-
Save gilesbowkett/7000440 to your computer and use it in GitHub Desktop.
script to compare all branches by date of most recent commit. silences `stderr` because otherwise git tells you every time it switches branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function silencing_stderr() { | |
$* 2>/dev/null | |
} | |
function branch_names() { | |
git br | awk '{print $1}' | grep -v '*' | xargs | |
} | |
function most_recent_commit() { | |
git log . | grep "Date: " | cut -c 9- | head -1 | |
} | |
for branch_name in $(branch_names) | |
do | |
silencing_stderr git co $branch_name | |
echo $branch_name $(most_recent_commit) | |
done | |
git co master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this also works:
git for-each-ref --format='%(committerdate) %(refname:short)'
https://twitter.com/wickedshimmy/status/390291332587323392