Delete branches that did not receive commits more than 4 weeks for k in $(git branch | sed /\*/d); do if [ -n "$(git log -1 --since='12 weeks ago' -s $k)" ]; then git branch -D $k fi done Log branches in order of commits received for branch in `git branch -r | grep -v HEAD`; do echo -e `git show --format="%ci %cr %(committerdate) %09 %(authorname) %09 %(refname)" $branch | head -n 1` \\t$branch; done | sort -r Log branches with creators names git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort Revert a commit after git push git push -f origin last_known_good_commit:branch_name
The reverting commits is useful to me.