Skip to content

Commit 4c84c55

Browse files
Separate worktree folders from branch names
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 74184f7 commit 4c84c55

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/docs/Ways-of-Working/Git-Worktrees.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ In a single ordinary clone the opposite is forced: one branch checked out at a t
3535
├── .bare/ # bare git data (the actual repository)
3636
├── .git # file containing: gitdir: ./.bare
3737
├── <default>/ # worktree: default branch (always clean, never worked in directly)
38-
├── 42-add-pagination/ # worktree: issue #42 in progress
39-
└── 99-fix-null-ref/ # worktree: issue #99 in progress
38+
├── 42-add-pagination/ # worktree folder; branch: feat/42-add-pagination
39+
└── 99-null-ref/ # worktree folder; branch: fix/99-null-ref
4040
```
4141

4242
- **`.bare/`** — the shared git object store. All worktrees share this.
4343
- **`.git`** — a file (not a directory) that points git tooling to `.bare/`.
4444
- **`<default>/`** — the default branch worktree (e.g. `main` or `master`). Kept as a clean reference. Used for diffing, reading docs, running comparisons. Never directly committed to.
45-
- **`<N>-<slug>/`** — one worktree per issue in flight. Named by issue number and a short slug. Branch name matches the folder name.
45+
- **`<N>-<slug>/`** — one worktree folder per issue in flight, named by issue number and a short slug. The folder is a concise local path; its branch uses the required `<type>/<issue>-<slug>` name, so the two names do not need to match.
4646

4747
## Remotes
4848

@@ -105,14 +105,16 @@ git -C .bare config "branch.$defaultBranch.merge" "refs/heads/$defaultBranch"
105105
```powershell
106106
# From the repo root (where .bare/ lives)
107107
$defaultBranch = git -C .bare symbolic-ref HEAD | ForEach-Object { $_ -replace 'refs/heads/', '' }
108-
git -C .bare worktree add ../42-add-pagination -b 42-add-pagination $defaultBranch
108+
$worktreeName = '42-add-pagination'
109+
$branchName = 'feat/42-add-pagination'
110+
git -C .bare worktree add "../$worktreeName" -b $branchName $defaultBranch
109111
110112
# Set upstream tracking (prevents "Publish Branch" prompt in VS Code)
111-
git -C .bare config branch.42-add-pagination.remote origin
112-
git -C .bare config branch.42-add-pagination.merge refs/heads/42-add-pagination
113+
git -C .bare config "branch.$branchName.remote" origin
114+
git -C .bare config "branch.$branchName.merge" "refs/heads/$branchName"
113115
114116
# Open in VS Code
115-
code 42-add-pagination
117+
code $worktreeName
116118
```
117119

118120
Then follow the normal Implement flow: initial commit → push → draft PR → build → finalize.
@@ -124,7 +126,7 @@ Then follow the normal Implement flow: initial commit → push → draft PR →
124126
git -C .bare worktree remove 42-add-pagination
125127
126128
# Delete the local branch ref
127-
git -C .bare branch -D 42-add-pagination
129+
git -C .bare branch -D feat/42-add-pagination
128130
129131
# Prune if needed (removes stale worktree references)
130132
git -C .bare worktree prune

0 commit comments

Comments
 (0)