Skip to content

Instantly share code, notes, and snippets.

@nickpresta
Created January 8, 2013 23:11
Show Gist options
  • Save nickpresta/4488926 to your computer and use it in GitHub Desktop.
Save nickpresta/4488926 to your computer and use it in GitHub Desktop.
Clean merged branches.
#!/bin/sh
printf "\e[32mRemoving merged branches:\n\033[0m"
git branch --merged master | grep -v master
read -p "Are you sure? " -n 1
echo "\n"
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
git branch --merged master | grep -v master | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment