Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created April 3, 2015 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcromartie/2e9cffdc82b5aa15b6eb to your computer and use it in GitHub Desktop.
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
#!/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