Skip to content

Instantly share code, notes, and snippets.

@gilesbowkett
Last active December 25, 2015 15:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save gilesbowkett/7000440 to your computer and use it in GitHub Desktop.
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
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
@gilesbowkett
Copy link
Author

this also works:

git for-each-ref --format='%(committerdate) %(refname:short)'

https://twitter.com/wickedshimmy/status/390291332587323392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment