Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .agents/skills/new-session/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,14 @@ Multiple worktrees share the same database. To avoid conflicts, **create worktre
- Filter to your worktree's entity when testing in the browser or e2e tests.

**Schema migrations are the exception.** If your feature requires `prisma db push` with breaking changes, check `git worktree list` and warn the user before pushing.

## Worktree Recovery

When work has accidentally accumulated in the main checkout and needs to move to a worktree:

1. Commit or stash the main-checkout changes on the correct branch.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply stashed changes in the recovered worktree

If the stash option here is used, the recovery steps never apply or pop that stash in the candidate/new worktree; the later fast-forward step only moves committed branch refs. In the case where main has uncommitted work that gets stashed, the selected worktree will still be clean and the actual changes remain hidden in the main checkout's stash, making the recovery appear to have lost the work. Either require committing before reuse or add an explicit git stash apply/pop step in the destination worktree.

Useful? React with 👍 / 👎.

2. Run `git worktree list --porcelain` to inspect existing worktrees.
3. If a clean candidate exists (no branch-only commits, compatible branch), fast-forward it to the target branch and use it rather than creating another worktree.
4. Create a new worktree only when no clean candidate exists.

Reusing a clean worktree minimizes workspace sprawl and avoids branch clutter.