Created
November 23, 2015 18:03
-
-
Save crakjie/7e4a7b924370b0ff944d to your computer and use it in GitHub Desktop.
Delete each branch that already in the branch master. Put it in you path and you will have auto complete functionality of git.
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/bash | |
while read -r line | |
do | |
if [ "$line" != "origin/master" ] && [ "$line" != "origin/HEAD -> origin/master" ] | |
then | |
inMaster=$(git branch master --contains $line) | |
if [ "$inMaster" = " master" ] || [ "$inMaster" = "* master" ] | |
then | |
branchName=${line#origin/} | |
echo "$inMaster" | |
echo "$branchName" | |
echo "$line" | |
git push origin :$branchName | |
fi | |
fi | |
#echo "$line" | |
done < <(git branch -r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment