Repository navigation
Allow worktree removal when only a stale REBASE_HEAD remains - #7866
Merged
Merged
Conversation
Git leaves REBASE_HEAD in the worktree's git dir after a conflicted rebase finishes, so the removal guard treated every such checkout as mid-rebase and refused to retire it forever. An in-progress rebase is already caught by rebase-merge and rebase-apply. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The worktree removal guard added in #6828 treated a
REBASE_HEADfile in a linked worktree's git dir as an in-progress rebase. Git does not deleteREBASE_HEADwhen a rebase that stopped on a conflict finishes withgit rebase --continue, so every checkout that once resolved a rebase conflict was permanently refused with "finish or abort the Git operation (REBASE_HEAD) first." Settings → Storage showed 16 such leftover worktrees (75 GB) on one machine, each with a cleangit statusand norebase-merge/orrebase-apply/directory.What changed
plugins/environment-git-worktree/host/worktree.ts: dropREBASE_HEADfrom the operation markers. A rebase that is actually in progress is still detected throughrebase-mergeandrebase-apply. No wire, CLI, or config changes.How you verified
REBASE_HEADremains, and expects removal to succeed. It fails against the old guard with the same message seen in Storage settings, and passes with the change.pnpm exec turbo run test typecheck --filter=bb-plugin-environment-git-worktree: 157 tests pass.🤖 Generated with Claude Code