Created
March 20, 2013 07:08
-
-
Save aphahn/5202851 to your computer and use it in GitHub Desktop.
Tired of cleaning out your merged Gerrit branches by hand? Freaked out when git tells you your branches aren't fully merged yet (but it's actually fine because it changed SHA1 at rebase time)? Just run `gerrit-clean` in your repository and it will delete branches that have been merged into your master.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gerrit-clean () { | |
for branch in $(git for-each-ref --format='%(refname:short)' refs/heads/); do | |
if git log master|ack -1 "$(git log "$branch"|ack -1 Change-Id)" > /dev/null; then | |
if [ "$branch" != "master" ]; then | |
git branch -D "$branch" | |
fi | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment