docs(advanced-git): warn about bare-name worktree resolution trap#32
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds an explicit warning to the “Bare-Worktree Project Layout (Recommended)” docs to prevent accidentally creating worktrees inside the bare repo when using git -C .bare.
Changes:
- Document the path-resolution trap when running
git -C .bare worktree add <path> <branch>with a bare (non-prefixed)<path>. - Provide “wrong vs right” examples using sibling-relative (
../...) and absolute paths. - Add a recovery section describing how to move a mistakenly created worktree.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dddb763 to
551b90f
Compare
There was a problem hiding this comment.
Pull request overview
Adds a targeted warning to the advanced Git workflow docs to prevent accidental creation of a worktree directory inside the bare repo when using git -C .bare worktree add, and documents a safe recovery path.
Changes:
- Documented the
-C .barepath-resolution trap (feature-xvs../feature-x/ absolute paths). - Added a recovery recipe using
git worktree movewith absolute paths (and an alternative safe invocation pattern).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`git -C .bare worktree add <name> <branch>` resolves <name> relative to the `.bare/` directory, not the current working directory. A bare name without a prefix (e.g. `feature-x` instead of `../feature-x`) creates `.bare/feature-x` — a repo-inside-a-repo mess that confuses tools (lockfile scanners, release scripts, IDE workspace detection) and violates the sibling-layout convention the skill already documents. Add a warning block with the wrong vs right patterns, and a recovery note showing how to move a misplaced worktree with absolute paths (`worktree move` inherits the same relative-path trap, so the recovery command must use absolute paths too). Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
551b90f to
18a83f5
Compare
There was a problem hiding this comment.
Pull request overview
Adds an explicit warning to the advanced Git “bare-worktree project layout” documentation about a common git -C .bare worktree add trap where a bare path (e.g., feature-x) is resolved inside .bare/, creating an unintended in-bare worktree.
Changes:
- Documented wrong vs right
worktree addinvocation patterns (feature-xvs../feature-x/ absolute path). - Added guidance on creating a new branch during
worktree addvia-b ... <start>. - Added recovery instructions for moving a mistakenly created in-bare worktree.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (Alternatively, drop `-C .bare` and run from the repo parent; then the | ||
| source `.bare/feature-x` resolves against that parent rather than | ||
| against `.bare/`.) |
Small retrospective contribution from netresearch/t3x-nr-image-optimize session.
What
Added a warning block to the bare-worktree-layout section explaining that
git -C .bare worktree add <name> <branch>resolves<name>relative to the.bare/directory, not the current working directory. A bare name without a prefix creates.bare/feature-x— a repo-inside-a-repo mess that violates the sibling-layout convention the skill already documents (and drew real user frustration during today's session).Why
The skill already shows the right pattern (
../feature-x) in all its examples, but doesn't explicitly warn about what happens if you forget the prefix. Hit this three times today before remembering to use absolute paths. The existing examples are correct; this just makes the failure mode explicit so a future reader doesn't have to rediscover it.Content
feature-xvs.../feature-x/ absolute)worktree movewith absolute paths (same trap applies tomove, so the recovery command must use absolute paths)Test plan