GIT-DELETE-SQUASHED-BRANCHES(1)

πŸ’– git-delete-squashed-branches(1) πŸ’–

okay bestie, welcome to git-delete-squashed-branches, a little script from the Git Extras collection and honestly? it's giving cleanup queen energy ✨


🌸 NAME 🌸

git-delete-squashed-branches β€” delete branches that were squashed πŸ§ΉπŸ’…

like, literally the branch equivalent of clearing out your camera roll. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

git-delete-squashed-branches [--proceed, -p] [<branch-name>]

that's it. that's the whole vibe. optional flag, optional branch name, infinite inner peace 🫢


✨ DESCRIPTION ✨

Deletes all git branches that have been "squash-merged" into branch-name.

so if you squashed a whole pile of work down into one commit and merged it, those old branches are just... sitting there. haunting the place. this command evicts them. iconic behavior honestly πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

  • --proceed, -p β€” proceed with the next branch even if the current branch cannot be deleted (e.g. because it is checked out in a worktree). so if one branch refuses to go, you just keep it moving and handle the rest. respect the boundary, skip the drama πŸ™ˆ
  • <branch-name> β€” the target branch where the "squashed-merged" branches were committed to. if no value is given, then the current checked out branch will be used. so yes, you can be lazy about it and it'll just assume you mean wherever you're standing rn πŸ’–

🌈 EXAMPLES 🌈

delete everything that got squashed into whatever branch you're on right now

$ git delete-squashed-branches

Delete all branches that were "squash-merged" into the current checked out branch. easy. no thoughts, just cleanup 🌸

or be specific and aim at main

$ git delete-squashed-branches main

Delete all branches that were "squash-merged" into the main branch. This will checkout the target branch and leave you on said branch after the command has completed.

⚠️ heads up bestie β€” this one moves you. it checks out the target branch and you stay there afterward. so don't be surprised when you look up and you're on main. that's not a glitch, that's the plan πŸ’€βœ¨

πŸ’œ AUTHOR πŸ’œ

Written by Teddy Katz <teddy.katz@gmail.com> and Vladimir Jimenez <me@allejo.io>

two absolute legends. we stan. πŸ‘‘πŸ‘‘


πŸ“ REPORTING BUGS πŸ“

<https://github.com/tj/git-extras/issues>

found something cursed? drop it there, they'll fix it. fr fr πŸ›


🧚 SEE ALSO 🧚

<https://github.com/tj/git-extras>

the whole git-extras cinematic universe. go explore, it slays 🌟


lowkey reminder: this page is for git-delete-squashed-branches, section 1, coming out of Git Extras, dated May 2026. that's the whole footer situation, folded up all cute at the bottom like a little bow πŸŽ€

bye bestie, go delete some branches πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from