Skip to content

Instantly share code, notes, and snippets.

@tarto-dev
Created September 15, 2014 14:16
Show Gist options
  • Select an option

  • Save tarto-dev/d64c2360b7191e059f90 to your computer and use it in GitHub Desktop.

Select an option

Save tarto-dev/d64c2360b7191e059f90 to your computer and use it in GitHub Desktop.
git checkout develop
git fetch
git remote prune origin
#Remove locally
git branch --merged develop | grep -v 'develop$' | xargs git branch -d
echo "Branches merged, to delete:"
git branch -r --merged develop | sed 's/ *origin\///' | grep -v 'develop$'
read -p "Sure about that (y/n)? "
if [ "$REPLY" == "y" ]
then
#Remove remotely
git branch -r --merged develop | sed 's/ *origin\///' \
| grep -v 'develop$' | xargs -I% git push origin :%
echo "Done!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment