-
-
Save trashhalo/8871121 to your computer and use it in GitHub Desktop.
Cleans up local tracking branches that dont exist on the remote. Removes all remote branches that have been merged into 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
# clean up merged local branches | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |
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
# clean up merged remote branches | |
git fetch -p && git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v 'rel_' | | |
grep -v 'emer_' | | |
grep -v master | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change Log: