Created
April 7, 2014 15:02
-
-
Save jschaul/10022023 to your computer and use it in GitHub Desktop.
delete git feature branches that are no longer needed since they have been merged.
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
#assumes that there is a "develop" branch | |
git checkout develop | |
echo "the following branches have been merged into the develop branch." | |
echo "By proceeeding they will be purged from your local machine and from the remote:" | |
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 | |
while true; do | |
read -p "Do you want to proceed? (y/n): " yn | |
case $yn in | |
[Yy]* ) break;; | |
[Nn]* ) echo "* You canceled; "; exit;; | |
* ) echo "| Please type (Y/N): ";; | |
esac | |
done | |
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git push --delete origin | |
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | xargs -n 1 git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment