Skip to content

Instantly share code, notes, and snippets.

@radfahrer
Last active December 20, 2015 10:39
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 radfahrer/6117536 to your computer and use it in GitHub Desktop.
Save radfahrer/6117536 to your computer and use it in GitHub Desktop.
cleanup merged branches
#!/usr/bin/env sh
git checkout master
for BRANCH in $(git branch --merged | grep -v "*")
do
git branch -d $BRANCH
done
git remote prune origin
@sjungling
Copy link

Made a minor change to add in shell check and the right git branch command

#!/usr/bin/env sh

for BRANCH in $(git branch --merged | grep -v "*")
do
    git branch -d $BRANCH
done

git remote prune origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment