Created
April 3, 2015 19:24
-
-
Save jcromartie/2e9cffdc82b5aa15b6eb to your computer and use it in GitHub Desktop.
git cleanup - delete branches that are fully merged relative to the current branch
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 | |
for branch in $(git branch --merged | grep -v '*') | |
do | |
read -n 1 -p "Delete ${branch} [y/N]? " answer | |
echo "" | |
if [[ "$answer" = "y" ]] | |
then | |
git branch -d "$branch" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment