Skip to content

Conversation

@built-by-as
Copy link
Owner

@built-by-as built-by-as commented Oct 24, 2025

Summary

Simplifies the worktree creation logic by appending a short UUID to the worktree path when a conflict is detected, instead of forcefully removing existing worktrees and deleting branches. This approach is cleaner and less destructive.

Changes

  • Append short UUID to worktree path if directory already exists
  • Remove forced worktree removal logic (git worktree remove --force)
  • Remove forced branch deletion logic (git branch -D)
  • Move shortUuid extraction earlier in the function for reuse
  • Change worktreePath from const to let to allow modification

Benefits

  • Avoids destructive operations on existing worktrees/branches
  • Simpler code with fewer edge cases to handle
  • Reduces potential for errors during worktree cleanup
  • Maintains uniqueness through path modification rather than deletion

Test plan

  • Build passes
  • All tests pass (13/13)
  • Manual testing: Create multiple sessions with same name to verify unique paths are created

Instead of forcefully removing existing worktrees and branches, append
a short UUID to the worktree path when a conflict is detected. This
approach is cleaner and avoids destructive operations.

Changes:
- Append short UUID to worktree path if directory already exists
- Remove forced worktree removal logic
- Remove forced branch deletion logic
- Move shortUuid extraction earlier for reuse
- Change worktreePath from const to let for modification

Co-Authored-By: Claude <[email protected]>
@built-by-as built-by-as merged commit 5cdef33 into main Oct 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants