Skip to content

Instantly share code, notes, and snippets.

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)
silencing_stderr git co $branch_name
echo $branch_name $(most_recent_commit)
git co master
Copy link

gilesbowkett commented Oct 16, 2013

this also works:

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

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