Add gt worktree remove command and fix cross-rig worktree creation
- Add WorktreeAddExistingForce to git package (uses --force flag) - Fix worktree creation: use force flag so main can be checked out in multiple worktrees (needed for cross-rig work) - Implement 'gt worktree remove <rig>' with --force flag - Refuse to remove worktrees with uncommitted changes unless forced 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -476,6 +476,13 @@ func (g *Git) WorktreeAddExisting(path, branch string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// WorktreeAddExistingForce creates a new worktree even if the branch is already checked out elsewhere.
|
||||
// This is useful for cross-rig worktrees where multiple clones need to be on main.
|
||||
func (g *Git) WorktreeAddExistingForce(path, branch string) error {
|
||||
_, err := g.run("worktree", "add", "--force", path, branch)
|
||||
return err
|
||||
}
|
||||
|
||||
// WorktreeRemove removes a worktree.
|
||||
func (g *Git) WorktreeRemove(path string, force bool) error {
|
||||
args := []string{"worktree", "remove", path}
|
||||
|
||||
Reference in New Issue
Block a user