Created
April 9, 2013 22:03
-
-
Save bjorg/5349825 to your computer and use it in GitHub Desktop.
Script to delete all *remote* branches that have been merged into the local master branch. Useful after updating the local master branch and removing the remote branches that have been merged into master.
This file contains hidden or 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
| #!/bin/sh | |
| git remote prune origin | |
| git branch -r --merged origin/master | awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | xargs git push origin --delete | |
| git remote prune origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment