You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Delete the local branch when a merged worktree is cleaned up
#15554
Worktree cleanup deliberately keeps branches so that resuming a thread can recreate its checkout. That makes sense for inactive or unchanged worktrees, but not once the pull request is merged. Its content is then in the target branch, and the host has usually deleted the remote branch, so the local branch has nothing left to offer. With one worktree per thread, these merged branches pile up in every project, and we delete them by hand. Squash merges make that tedious, because git branch -d refuses them and each branch needs a manual check before git branch -D.
Proposal
When Delete merged worktrees removes a worktree, also delete its local branch, possibly behind its own toggle such as Also delete merged branches. Delete it only when all of these hold:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem
Worktree cleanup deliberately keeps branches so that resuming a thread can recreate its checkout. That makes sense for inactive or unchanged worktrees, but not once the pull request is merged. Its content is then in the target branch, and the host has usually deleted the remote branch, so the local branch has nothing left to offer. With one worktree per thread, these merged branches pile up in every project, and we delete them by hand. Squash merges make that tedious, because
git branch -drefuses them and each branch needs a manual check beforegit branch -D.Proposal
When Delete merged worktrees removes a worktree, also delete its local branch, possibly behind its own toggle such as Also delete merged branches. Delete it only when all of these hold:
Resuming such a thread would start a fresh worktree from the default branch, or offer to.
Related
All reactions