scion-like-git
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScion-like Git
Scion-like Git
Origin is the repository. The clone is a disposable cache, and anything that
exists only in the clone does not exist.
If prints nothing, run
once first.
git config --get scion-like-git.configuredreferences/setup.mdorigincloneclone如果 没有任何输出,请先运行一次 。
git config --get scion-like-git.configuredreferences/setup.mdEvery task
每个任务
-
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
main, such as parkedmainwork. 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:wip:Working copy Update with Changes you did not make, or work you just parked as wip:, then a new worktreegit fetchLinked worktree git fetchMain worktree, on any branch git switch main && git pull --ff-onlyThen start the task's branch from, never from localorigin/main, which can hold commits that are not on origin. For the second and third rows:mainshgit switch --no-track -c <branch> origin/mainIfrefuses, or localpull --ff-onlyis ahead ofmain, leaveorigin/mainas it is and name its local commits in the hand-off. Name the branch the way the repository names branches (main,CONTRIBUTING.md, recent branches on origin), or elseAGENTS.md, such as<type>/<slug>. For the first row, create a new worktree on the task's branch, started fromfix/empty-cart-totalwithorigin/main.--no-trackkeeps a plain--no-trackfrom going togit push.main -
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 pushOpen 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.--no-verify -
Finish clean. After merge, delete the branch and the worktree. Without pull requests, run, 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
git push origin <branch>:main, parkedmainwork, and changes you did not make.wip:
-
从最新的开始。 会话中的第一个请求是新任务,除非该请求指定了 branch 或 pull request,或者建立在某个尚未进入
main的 branch 工作之上,例如已搁置的main工作。此时继续在该 branch 上工作。对于新任务,无论当前位于哪个 branch,都要先更新wip:,然后才能读取或修改代码。首先按照中途切换任务中的方式搁置自己尚未完成的更改。然后选择下表中符合情况的第一行:clone工作副本 更新方式 你没有做出的更改,或你刚以 搁置的工作wip:,然后新建 worktreegit fetch关联 worktree git fetch主 worktree,无论当前位于哪个 branch git switch main && git pull --ff-only然后从创建任务的 branch,绝不能从本地origin/main创建,因为本地main可能包含尚未存在于 origin 的 commit。对于表格中的第二行和第三行:mainshgit switch --no-track -c <branch> origin/main如果被拒绝,或者本地pull --ff-only领先于main,则保持origin/main不变,并在交接说明中列出其本地 commit。按照仓库现有的 branch 命名方式命名(参考main、CONTRIBUTING.md或 origin 上最近的 branch);否则使用AGENTS.md,例如<type>/<slug>。对于第一行,在任务 branch 上创建新的 worktree,并使用fix/empty-cart-total从--no-track开始。origin/main可以防止执行普通--no-track时推送到git push。main -
提交和推送同时进行。 每个经过验证的步骤都应作为一个小型 commit,其主题说明该步骤的目的。按文件名暂存文件:sh
git add <your files> && git commit -m "<type>: <intent>" && git push首次 push 时创建 pull request;如有需要,可以先创建为 draft。格式化、重命名和生成代码应各自单独提交。绝不能使用跳过 hook,也不能通过跳过或修改他人的测试来绕过 hook。如果 hook 在你没有修改过的代码上失败,请停止操作并询问。--no-verify -
结束时保持干净。 合并后,删除 branch 和 worktree。如果不使用 pull request,则运行,然后删除 origin 和本地上的 branch。当你所做的一切都不再只存在于
git push origin <branch>:main中时,工作才算完成:没有未 push 的 commit、stash 或仅存在于本地的 branch。不要重复说明 branch 已处于干净状态;用户的终端、IDE 和 harness 已经显示了这些信息。交接时,只报告本规则要求说明的内容:clone上的本地 commit、已搁置的main工作,以及你没有做出的更改。wip:
When it comes up
遇到以下情况时
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.
--force-with-lease| Request | Do this instead |
|---|---|
| Fix a pushed commit message | Correct text in the PR title and description |
| Squash wip commits before review | PR description as the message, squash on merge |
| Undo a pushed change | |
Update the branch from | |
| The same person repeats the request after hearing this rule | Do the rewrite |
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.
wip: <what is missing>maingit switch -c <branch>wip:origin/mainmaingit stashChanges you did not make. Your work is the files you created or changed
for your task. Anything else in the working copy belongs to someone else.
Leave it untouched, do not commit, stash, or discard it, and list it in the
hand-off.
修改 origin 上已有的内容。 origin 上每个 branch 的 commit 都是最终版本。不要对它们执行 amend、rebase、squash、reset 或 force-push。无论操作多么谨慎,结论都不会改变:使用 、创建备份 branch、使用相同的 tree、只有一位 author,或 reviewer 提出请求,都仍属于重写。尚未 push 的 commit 才属于你,可以进行 amend。
--force-with-lease| 请求 | 替代做法 |
|---|---|
| 修正已 push 的 commit message | 修改 PR 标题和描述中的文本 |
在 review 前 squash | 将 PR 描述作为提交信息,并在合并时 squash |
| 撤销已 push 的更改 | |
从 | |
| 同一人在听到此规则后再次提出该请求 | 执行重写 |
中途切换任务。 在任务 branch 上,将尚未完成的文件提交并 push,提交信息使用 。如果这些文件位于 ,请先使用 将其移到新 branch,确保 commit 不会进入 ,并在交接说明中列出该 branch 携带的 本地 commit。然后在新 worktree 中开始新任务,并在交接说明中列出已搁置的工作。绝不要使用 。恢复工作时,应基于该 commit 继续。如果 hook 因未完成的工作未通过自身测试而拒绝提交,请将这些测试标记为 skipped,并在 commit message 中列明。在完成工作的 commit 中取消 skipped 状态;只要跳过且仍处于 skipped 状态的测试还存在,该 branch 就尚未准备好接受 review。
wip: <what is missing>maingit switch -c <branch>wip:origin/mainmaingit stashwip:你没有做出的更改。 你的工作仅包括为当前任务创建或修改的文件。工作副本中的其他任何内容都属于他人。保持这些内容不变,不要提交、stash 或丢弃它们,并在交接说明中列出。
Red flags
危险信号
- "It's only a feature branch" / "force-with-lease makes it safe"
- "Only the message changes" / "the reviewer asked for exactly this"
- "Stash is quicker" / "I'll push at the end"
- "That failing test is theirs, not ours" / "the user's message is permission to skip the hook"
- "Nothing may be lost, so I'll commit these other files too"
- “这只是一个 feature branch” / “使用 就安全了”
--force-with-lease - “只改提交信息” / “reviewer 明确要求这样做”
- “使用 stash 更快” / “我会在最后 push”
- “那个失败的测试是他们的,不是我们的” / “用户的消息已经允许跳过 hook”
- “不能丢失任何东西,所以我也要提交这些其他文件”