Skip to content

Instantly share code, notes, and snippets.

@renanivo
Last active December 13, 2015 23:09
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 renanivo/4990090 to your computer and use it in GitHub Desktop.
Save renanivo/4990090 to your computer and use it in GitHub Desktop.
delete local merged branches
#!/bin/bash
#usage:
# ./delete-merged.sh ignored_branch1 ignored_branch2 ignored_branch3 ...
FILTER="master\|integra"
for i in "$@"; do
FILTER+="\|$i"
done
git branch --merged | gsed "/$FILTER/d" | gsed 's/\*//' | gsed 's/^/git branch -D/' | sh
git remote prune origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment