Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This has to be run from master
- echo "Checking out master branch..."
- git checkout master
- # Update our list of remotes
- echo "Pruning list of remotes..."
- git fetch
- git remote prune origin
- # Remove local fully merged branches
- echo "Checking for merged branches..."
- for i in $( git for-each-ref refs/heads --format='%(refname:short)' --merged ); do
- if [ $i != master ]
- then
- echo $i has already been merged into another branch. Would you like to delete it?
- read -p "Delete branch (y/n)? "
- if [ "$REPLY" == "y" ]
- then
- git branch -d $i
- fi
- fi
- done
Add Comment
Please, Sign In to add comment