Skip to content

docs(dev-practices): add multi-session-worktrees-guide.md#41

Closed
rafael5 wants to merge 1 commit into
mainfrom
dev-practices-worktrees-guide
Closed

docs(dev-practices): add multi-session-worktrees-guide.md#41
rafael5 wants to merge 1 commit into
mainfrom
dev-practices-worktrees-guide

Conversation

@rafael5
Copy link
Copy Markdown
Contributor

@rafael5 rafael5 commented May 11, 2026

Summary

Companion to parallel-multi-repo-git-hygiene.md Rule 2. Where the strategic doc names the rule, this guide is the operational manual:

  • Layout convention: sibling-of-main-checkout, <repo>-<branch-slug> naming
  • Three setup variants (existing local branch, new branch, remote-only branch)
  • Daily usage and per-worktree git fetch pattern
  • Cleanup and git worktree prune
  • Six gotchas: direnv, .venv/, pytest cache pinning, branch-already-checked-out errors, CI orthogonality, "don't run sessions in the main checkout"
  • Bootstrap script for setting up worktrees across the existing org

Also wires Rule 2 of the strategic doc and the dev-practices/README.md index to point at this guide.

The session that authored this PR itself fell into the multi-session trap mid-flight (commit briefly landed on main because another session ran git checkout main in the same working tree between checkout -b and commit) — exactly the failure mode this guide is meant to prevent.

Test plan

  • make check-docs-prose passes
  • Links from parallel-multi-repo-git-hygiene.md §Rule 2 and dev-practices/README.md index resolve
  • Frontmatter conforms to docs-discoverability spec

🤖 Generated with Claude Code

The strategic doc (parallel-multi-repo-git-hygiene.md) names Rule 2
"worktrees for parallel branches in the same repo" but only shows the
one-line setup command. This guide is the operational companion:
layout convention (sibling-of-main-checkout, <repo>-<branch-slug>
naming), three setup variants, daily usage, cleanup + pruning, six
gotchas (direnv, .venv, pytest cache, branch-already-checked-out,
CI-doesn't-care, don't-run-sessions-in-main-checkout), and a
bootstrap script for adopting the convention across the existing org.

Also:
- Rule 2 of parallel-multi-repo-git-hygiene.md now points at this
  guide for the full mechanics.
- dev-practices/README.md index now lists both docs.

Authored after a multi-session collision in this very session
surfaced the need (see docs-discoverability phases-tracker §7
2026-05-11 entry).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafael5
Copy link
Copy Markdown
Contributor Author

rafael5 commented May 11, 2026

Closing — worktrees are an escape hatch, not the default. Adopting the simpler 'one session per repo' rule (Rule 1 of parallel-multi-repo-git-hygiene.md) as the front-and-center practice instead. Worktrees stay documented as a one-line option inside the strategic doc for the rare case they're needed. The cognitive overhead of layout convention + setup commands + cleanup + gotchas isn't worth it when the simpler rule covers the same problem.

@rafael5 rafael5 closed this May 11, 2026
@rafael5 rafael5 deleted the dev-practices-worktrees-guide branch May 11, 2026 17:27
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.

1 participant