Skip to content

Instantly share code, notes, and snippets.

@joemaffia
Last active June 28, 2017 08:03
Show Gist options
  • Save joemaffia/749e0e55978a4969e4411f6c0e64e3ca to your computer and use it in GitHub Desktop.
Save joemaffia/749e0e55978a4969e4411f6c0e64e3ca to your computer and use it in GitHub Desktop.
Delete git merged branches
#local
git branch --merged | grep -v '\*\|master\|develop' | xargs -n 1 git branch -d
#remote
git branch -r --merged | grep -v '\*\|master\|develop' | sed 's/origin\///' | xargs -n 1 git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment