Origin is the repository. The clone is a disposable cache, and anything that
exists only in the clone does not exist.
-
Start from the newest . The first request of a session is a new
task, unless it names a branch or pull request, or builds on work that is
on a branch and not yet on
, such as parked
work. Then
continue on that branch. For a new task, update the clone before you read
or change any code, whatever branch it is on. Park unfinished changes of
your own first, as in
Switching tasks mid-work. Then use the first row
that fits:
| Working copy | Update with |
|---|
| Changes you did not make, or work you just parked as | , then a new worktree |
| Linked worktree | |
| Main worktree, on any branch | git switch main && git pull --ff-only
|
Then start the task's branch from
, never from local
,
which can hold commits that are not on origin. For the second and third
rows:
sh
git switch --no-track -c <branch> origin/main
If
refuses, or local
is ahead of
,
leave
as it is and name its local commits in the hand-off. Name the
branch the way the repository names branches (
,
, recent branches on origin), or else
, such as
. For the first row, create a new worktree on the
task's branch, started from
with
.
keeps a plain
from going to
.
-
Commit and push together. Each verified step is one small commit whose
subject says what it is for. Stage your files by name:
sh
git add <your files> && git commit -m "<type>: <intent>" && git push
Open a pull request with the first push, as a draft if needed. Formatting,
renames, and generated code get their own commits.
Never skip hooks (
), and never skip or edit someone else's
tests to get past one. If a hook fails on code you did not change, stop
and ask.
-
Finish clean. After merge, delete the branch and the worktree. Without
pull requests, run
git push origin <branch>:main
, then delete the branch
on origin and locally. The work is finished when nothing you made exists
only in the clone: no unpushed commits, stashes, or local-only branches.
Do not restate a clean branch state; the user's terminal, IDE, and harness
already show it. Report only what the rules here say to name in the
hand-off: local commits on
, parked
work, and changes you did
not make.
Changing something already on origin. Commits on origin are final, on
every branch. Do not amend, rebase, squash, reset, or force-push them. Care
does not change this:
, a backup branch, an identical
tree, a single author, or a reviewer's request still make it a rewrite.
Commits not yet pushed are yours to amend.
Switching tasks mid-work. Commit and push your unfinished files as
on their task branch. If they sit on
, move
them to a new branch with
first, so the
commit never reaches
, and name any local commits on
that
the branch carries in the hand-off. Then start the new task in a new
worktree, and name the parked work in the hand-off. Never
. Resume
on top of the wip commit. If the hooks reject it because the unfinished work
fails its own tests, mark those tests as skipped and name them in the commit
message. Un-skip them in the commit that finishes the work; the branch is not
ready for review while a test you skipped is still skipped.