Skip to content

Commit b361f29

Browse files
author
Nick Sullivan
committed
📝 Base worktrees on origin/main to avoid unpushed commit bleed
1 parent 1343761 commit b361f29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rules/git-worktree-task.mdc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Worktrees isolate task branches in separate directories. Your main repo stays on
1515

1616
<workspace-setup>
1717
Create git worktree as a sibling directory (not nested inside the repo). Sibling directories avoid module resolution issues with ESLint, monorepo tools, and symlinked dependencies that break when worktrees are nested.
18-
</workspace-setup>
18+
19+
Always base worktrees on `origin/main`, not local `main`. Local main may have unpushed
20+
commits from other work that will bleed into your branch. </workspace-setup>
1921

2022
<port-isolation>
2123
Each worktree needs its own port for dev servers to avoid conflicts when running multiple tasks. Create a `.env.local` in the worktree with a unique PORT based on the task name (hash the name to a port offset from 3000, or use sequential assignment). This prevents "port already in use" errors and makes it clear which server belongs to which task.

0 commit comments

Comments
 (0)