Skip to content

Instantly share code, notes, and snippets.

@OJezu
Last active January 28, 2019 12:47
Show Gist options
  • Save OJezu/a6be6ec2529972db8b6c96217f4a1f5a to your computer and use it in GitHub Desktop.
Save OJezu/a6be6ec2529972db8b6c96217f4a1f5a to your computer and use it in GitHub Desktop.
git-fu
# delete remote merged branches
git branch -r --merged | grep origin | grep -v '>' | grep "^ origin/\(hotfix\|feature\|bugfix\)" | xargs -L1 | cut -d"/" -f 2- | xargs -r git push origin --delete
# delete local merged branches
git branch --merged | grep "^ \(hotfix\|feature\|bugfix\)" | xargs -L1 | xargs -r git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment