Created
April 10, 2026 09:29
-
-
Save squio/60beed00622b67526e0d28a793b62008 to your computer and use it in GitHub Desktop.
git: delete squash-merged branches when delete branch on merge is enabled in the remote service (GitHub, GitLab etc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| delete-merged() { | |
| git branch --format '%(if:equals=gone)%(upstream:track,nobracket)%(then)%(refname:short)%(end)' --omit-empty | while read branch; do | |
| git branch -D "$branch" | |
| done | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to
.zshrcand invoke on the command line: