Long lived git worktrees #56758
yringler
started this conversation in
Feature Requests
Replies: 1 comment
-
|
Please make this happen. I was burned by this and now I have a worktrees that ZED doesn't see and I cannot reuse |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What are you proposing?
Allow manual control over when worktree is deleted.
If I manually create something, I expect to be in charge of its full lifecycle - if I created it, it should remain in the state I set until I change that state myself. Currently, that is not the case: if zed sees that all threads referencing a worktree were archived, it removes the worktree.
Why does this matter?
Having long lived worktrees means that I always have an isolated worktree ready. The repo is cloned, and build dependencies are already in place —
node_modules,.venv, build caches, compiled binaries. Recreating these is expensive (minutes to tens of minutes depending on the project), so auto-deletion isn't just losing a directory; it's losing the warm state.I happen to name my worktrees after my siblings - it makes it easier to keep track of who's doing what when I have a few different agents adding different features / fixing different bugs.
Beyond the workflow cost, there's a UX principle at stake: ownership. There are two distinct models for how a worktree can come into existence:
For case 2, automatic cleanup is expected behavior. I didn't create it directly, so zed handling its lifecycle wouldn't surprise me.
For case 1, automatic cleanup violates the ownership contract. If I created it manually, I should remove it manually — without zed removing it for me based on the state of unrelated objects (threads).
Possible approach
Change the default: manually-created worktrees are never auto-removed. If zed-managed worktrees become a thing (from an abstracted flow like the hypothetical above), those would be subject to automatic cleanup.
A less invasive alternative is a setting to opt out of auto-removal for manually-created worktrees, preserving current behavior as the default.
Related to #55434
Beta Was this translation helpful? Give feedback.
All reactions