Repository navigation
AGENTS.md: branch from the freshly fetched origin/main - #223
Conversation
… main A session branched from a shared checkout's local main, weeks behind, and its pull request conflicted in every file it touched.
| from the default branch, and ends in a pull request: never edit the main | ||
| checkout, which may hold the person's own work. Once its pull request is | ||
| from the remote's default branch as just fetched (`git fetch origin`, then | ||
| `git worktree add -b <branch> <path> origin/main`), and ends in a pull |
There was a problem hiding this comment.
git worktree add -b <branch> <path> origin/main makes the new branch track origin/main (git's default branch.autoSetupMerge=true applies when the start point is a remote-tracking branch). I checked this: after that command, @{u} is origin/main, and a plain git push fails with "The upstream branch of your current branch does not match the name of your current branch". Git's hint then offers git push origin HEAD:main, so an agent that takes the hint pushes straight to main. Also, git pull and git status compare against main, not the PR branch. Add --no-track (git worktree add --no-track -b <branch> <path> origin/main), then publish with git push -u origin <branch>.
|
Claude review (house rules) |
"Branch off the default branch" read as the local
main, and a shared checkout's localmaincan be weeks behind. A Sheeping Around session branched from one and its popup PR conflicted in every file once rebased. Both places that say where to branch now name the freshly fetchedorigin/main(git fetch origin, thengit worktree add -b <branch> <path> origin/main), and say to fetch and rebase again before pushing if it moved.Text only, no code.