I’m trying to clean up some long-lived branches in our repo and came across this handy stackoverflow post to get branches by the date of the commit they branched from.
I’ve modified it slightly to be easier to use for my purposes:
git show-ref | { while read branch; do merge_base=$(git merge-base –all $branch master); date_branched=$(git show -s –format=format:"%cd %an” –date=short $merge_base); echo “$date_branched, $branch”; done } | sort