Repository navigation
Fix pruning git worktrees - #6
Merged
Merged
Conversation
git refuses to delete a branch that any worktree has checked out, under -d and -D alike, so pruning such a branch always failed. The delete now runs `git worktree remove` first, with --force in force mode. A branch that -d will refuse as unmerged keeps its worktree until the user accepts the force retry. A branch checked out in the main worktree cannot be marked, since git cannot remove the main worktree. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Rows mark a branch checked out in another worktree with +, as `git branch` does. The confirm screen and the force prompt name each worktree the delete removes, and say whether uncommitted changes are refused or discarded. The results screen reports each removed worktree. The help screen and README describe the behavior. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cover a clean worktree and one whose directory is gone, a dirty worktree in safe and force mode, an unmerged branch that keeps its worktree until the force retry, and a branch held by the main worktree. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add safeDeleteRefuses and worktreePending so deleteBranch, worktreeWarning, forceDeleteUnmerged and the force prompt share one test each instead of repeating the conditions. The kept-worktree case sets forceable directly rather than building an error string for the merge check to find. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
master split main.go into git.go, model.go and view.go and locked every branch checked out in another worktree. The worktree fix moves into the new files. Only a branch in the main worktree stays locked; a branch in a linked worktree is selectable, and its delete removes the worktree first. Script mode removes worktrees the same way as safe mode. The confirm screen now also warns that git deletes a worktree's ignored files, such as .env, which it does not count as changes. Mark the worktree bug in bugs.md as done. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A worktree is scratch space for its branch, so the delete now runs `git worktree remove --force` in safe and force mode alike. Safe mode no longer refuses a worktree with uncommitted changes. A locked worktree is still refused, and an unmerged branch still keeps its worktree until the force retry, since the commits are the work at risk there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
No description provided.