Skip to content

Instantly share code, notes, and snippets.

@sachsgit
Created October 28, 2022 14:28
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 sachsgit/bd4792d2650281bc0af21b9edddd7411 to your computer and use it in GitHub Desktop.
Save sachsgit/bd4792d2650281bc0af21b9edddd7411 to your computer and use it in GitHub Desktop.
Git Bash Shell Script to Remove Stale/Merged Branches
#!/bin/sh
# https://stackoverflow.com/questions/7726949/remove-local-branches-no-longer-on-remote
git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
rm /tmp/merged-branches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment