Skip to content

AGENTS.md: branch from the freshly fetched origin/main - #223

Merged
fleon merged 1 commit into
mainfrom
agents-branch-from-origin
Nov 28, 2026
Merged

fleon merged 1 commit into
mainfrom
agents-branch-from-origin

Conversation

@fleon

@fleon fleon commented Nov 28, 2026

Copy link
Copy Markdown
Owner

"Branch off the default branch" read as the local main, and a shared checkout's local main can 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 fetched origin/main (git fetch origin, then git worktree add -b <branch> <path> origin/main), and say to fetch and rebase again before pushing if it moved.

Text only, no code.

… main

A session branched from a shared checkout's local main, weeks behind, and
its pull request conflicted in every file it touched.
Comment thread AGENTS.md
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

claude Bot commented Nov 28, 2026

Copy link
Copy Markdown

Claude review (house rules)
Reviewed 1 file (AGENTS.md). Rules files read: AGENTS.md (the PR's version and the base version).
Left 1 inline comment.

@fleon
fleon merged commit 2e855e3 into main Nov 28, 2026
13 checks passed
@fleon
fleon deleted the agents-branch-from-origin branch November 28, 2026 11:06
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