Created
May 1, 2012 00:10
-
-
Save kylefritz/2563866 to your computer and use it in GitHub Desktop.
Delete branches that have been merged into HEAD
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
#all local branches that are merged into HEAD | |
git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'` | |
#Delete all remote branches that are merged into HEAD | |
#jump back to master | |
git co master | |
#get rid of all local branches not on origin | |
git remote prune origin | |
#list merged branches and push up | |
git push origin `git branch -r --merged | grep 'origin' | grep -v '/master$' | sed 's/origin\//:/g' | tr -d '\n'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment