Created
April 6, 2013 10:46
-
-
Save bquorning/5325718 to your computer and use it in GitHub Desktop.
Here's the script I use to remove my merged branches, both remote and local. Disclaimer: Don’t blame me if you use this script to remove something you wanted do keep. Maybe add the `-n` flag to `git push` while you’re trying out how the script works. If in trouble, read [man git-reflog](http://git-scm.com/docs/git-reflog).
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
git checkout master | |
git pull | |
git remote prune origin | |
git branch -r --merged | grep bquorning | awk -F'/' '{ print ":" $2 "/" $3 }' | xargs git push origin | |
git branch --merged | grep -v "\* master" | xargs git branch -d | |
# That was actually a somewhat simplified version. Here's what I really use: | |
git checkout master && git pull && (git remote prune origin && git branch -r --merged | grep bquorning | awk -F'/' '{ print ":" $2 "/" $3 }' | xargs git push origin) & ; git branch --merged | grep -v "\* master" | xargs git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment