Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

gilesbowkett commented Oct 16, 2013

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