Skip to content

Instantly share code, notes, and snippets.

@abritinthebay
Last active March 2, 2023 21:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abritinthebay/cacc0745f18d3eec4ef7eda3f6c1e09e to your computer and use it in GitHub Desktop.
Save abritinthebay/cacc0745f18d3eec4ef7eda3f6c1e09e to your computer and use it in GitHub Desktop.
How to delete merged git remote branches (git-flow safe)
git fetch --prune |
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v develop |
sed -E "s|^ *origin/||g" |
xargs git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment