Loading...
Loading...
Compare original and translation side by side
git status --short # Are there uncommitted changes?
git log --oneline -10 # What commits exist on this branch?
git branch --show-current # Which branch are we on?
BASE_BRANCH="<base-branch>" # e.g. main, develop, release/*
git fetch origin "$BASE_BRANCH"
git log --oneline "origin/$BASE_BRANCH"..HEAD # Commits unique to this branchmain--ontogit status --short # 是否存在未提交的更改?
git log --oneline -10 # 当前分支上有哪些提交?
git branch --show-current # 当前处于哪个分支?
BASE_BRANCH="<base-branch>" # 例如:main、develop、release/*
git fetch origin "$BASE_BRANCH"
git log --oneline "origin/$BASE_BRANCH"..HEAD # 当前分支独有的提交main--ontogit add <files> # Stage relevant files; be specific — don't `git add .` blindly
git commit -m "<type>(<scope>): <summary>
<body explaining why, not just what>
Closes #<issue-number>"featfixdocschorerefactortest(gemini)(tooling)(docs)(skills)Closes #NFixes #NRefs #Ngit add <files> # 暂存相关文件;请明确指定文件,不要盲目使用`git add .`
git commit -m "<type>(<scope>): <summary>
<body explaining why, not just what>
Closes #<issue-number>"featfixdocschorerefactortest(gemini)(tooling)(docs)(skills)Closes #NFixes #NRefs #NCOMMIT=$(git rev-parse HEAD)
git checkout -b feat/<short-description> "$COMMIT"feat/<description>fix/<description>docs/<description>chore/<description>COMMIT=$(git rev-parse HEAD)
git checkout -b feat/<short-description> "$COMMIT"feat/<description>fix/<description>docs/<description>chore/<description>git rebase "origin/$BASE_BRANCH"git rebase "origin/$BASE_BRANCH"undefinedundefined
Then rebase only the unique commits onto the selected base branch:
```bash
git rebase --onto "origin/$BASE_BRANCH" "$PARENT" HEAD
然后仅将唯一的提交变基到选定的基础分支:
```bash
git rebase --onto "origin/$BASE_BRANCH" "$PARENT" HEADgit log --oneline -5 # Should show: new commit(s) on top of origin/<base-branch> HEAD
git status # Should be cleangit add <file> && git rebase --continuegit rebase --skipgit log --oneline -5 # 应显示:origin/<base-branch> HEAD之上的新提交
git status # 应显示干净状态git add <file> && git rebase --continuegit rebase --skipjust test # All assertions must pass
just lint # Zero findingsjust test # 所有断言必须通过
just lint # 零检查结果git push origin <branch-name> -u-ugit pushgit pullmaingit push origin <branch-name> --force-with-lease--force-with-lease--forcegit push origin <branch-name> -u-ugit pushgit pullmaingit push origin <branch-name> --force-with-lease--force-with-lease--forcegh pr create \
--title "<type>(<scope>): <concise summary>" \
--base "$BASE_BRANCH" \
--head <branch-name> \
--body "$(cat <<'EOF'gh pr create \
--title "<type>(<scope>): <concise summary>" \
--base "$BASE_BRANCH" \
--head <branch-name> \
--body "$(cat <<'EOF'| Area | Files |
|---|---|
| <area> | <files> |
PR title rules:
- Same format as the commit message subject
- Must match the branch's purpose exactly
- ≤ 72 characters
Body rules:
- 2–4 bullet summary (what + why, not just what)
- Changes table for non-trivial diffs
- Use `Refs #N` for stacked/chained PRs and intermediate slices
- Use `Closes #N` only on the final PR that should auto-close the issue| 领域 | 文件 |
|---|---|
| <领域> | <文件> |
PR标题规则:
- 格式与提交信息主题行一致
- 必须完全匹配分支的用途
- ≤72字符
正文规则:
- 2-4条要点摘要(包含内容及原因,而非仅内容)
- 对于非微小差异,添加更改表格
- 堆叠/链式PR和中间阶段使用`Refs #N`
- 仅在最终PR上使用`Closes #N`以自动关闭问题feat/<topic>-base--base "$BASE_BRANCH"feat/<topic>-part-2feat/<topic>-base--base feat/<topic>-baseRefs #NCloses #Ngh pr edit --base <new-base>feat/<topic>-base--base "$BASE_BRANCH"feat/<topic>-basefeat/<topic>-part-2--base feat/<topic>-baseRefs #NCloses #N--force-with-leasegh pr edit --base <new-base>gh pr view # Confirm PR is open with correct title, base branch, and issue link$BASE_BRANCHRefs #NCloses #Ngh pr checksgh pr view # 确认PR已打开,标题、基础分支和问题关联正确$BASE_BRANCHRefs #NCloses #Ngh pr checks