Last active
January 28, 2016 03:07
-
-
Save Tzrlk/988c255b15110f613db4 to your computer and use it in GitHub Desktop.
Simple scripts to purge merged branches from your git server.
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
#!/bin/sh | |
echo "Switching to $1." | |
git symbolic-ref HEAD refs/heads/$1 | |
echo "Removing all merged branches." | |
git branch --merged | grep -i '$2' | xargs -n 1 git branch -d | |
echo "Switching back to master." | |
git symbolic-ref HEAD refs/heads/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
#!/bin/sh | |
echo "Purging all branches not matching '$1'" | |
git branch | grep -ni '$1' | xargs -i -n 1 git purge {} $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment