mirror of
https://github.com/sinanyuntu/trade-message-center.git
synced 2026-09-17 13:22:11 +08:00
chore: 完善发布 Git 分支 skill
This commit is contained in:
@@ -31,7 +31,31 @@ paths and wait for an explicit next instruction.
|
|||||||
the remote, update it only with `git push --force-with-lease origin HEAD`.
|
the remote, update it only with `git push --force-with-lease origin HEAD`.
|
||||||
Never use plain `--force`.
|
Never use plain `--force`.
|
||||||
6. Create a PR with the current branch as head and remote `main` as base. Use
|
6. Create a PR with the current branch as head and remote `main` as base. Use
|
||||||
the repository's configured PR tooling and report its URL.
|
the repository's configured PR tooling, write its title and body in Chinese,
|
||||||
|
and report its URL.
|
||||||
|
|
||||||
|
## Naming And PR Language
|
||||||
|
|
||||||
|
When a branch needs a new name, use `<type>/<short-kebab-topic>`. Choose the
|
||||||
|
type for the actual change:
|
||||||
|
|
||||||
|
| Type | Use for |
|
||||||
|
| --- | --- |
|
||||||
|
| `feat` | 新功能或用户可见能力 |
|
||||||
|
| `fix` | 缺陷修复 |
|
||||||
|
| `chore` | 维护、工具或流程变更 |
|
||||||
|
| `docs` | 文档变更 |
|
||||||
|
| `refactor` | 不改变预期行为的重构 |
|
||||||
|
| `test` | 测试覆盖或测试工具变更 |
|
||||||
|
| `ci` | 持续集成或发布自动化变更 |
|
||||||
|
|
||||||
|
Do not rename an existing branch solely to normalize its style; this convention
|
||||||
|
applies when creating a branch or correcting an obvious semantic mismatch.
|
||||||
|
|
||||||
|
PR title and body must be Chinese. The title must begin with the conventional
|
||||||
|
type prefix that matches the change, for example `fix: 修复 Chrome 消息回调兼容性`;
|
||||||
|
its descriptive text must be Chinese. The body must describe the change,
|
||||||
|
validation, and any risk or follow-up in Chinese.
|
||||||
|
|
||||||
## Invariants
|
## Invariants
|
||||||
|
|
||||||
@@ -39,6 +63,8 @@ paths and wait for an explicit next instruction.
|
|||||||
`main`; changes reach `main` only through the PR.
|
`main`; changes reach `main` only through the PR.
|
||||||
- Branch renaming is required only for an obvious semantic mismatch, not a
|
- Branch renaming is required only for an obvious semantic mismatch, not a
|
||||||
stylistic preference. State the evidence used to judge the mismatch.
|
stylistic preference. State the evidence used to judge the mismatch.
|
||||||
|
- PR title must use the type prefix that matches the change, such as `feat:` or
|
||||||
|
`fix:`; the remaining title text and body use Chinese.
|
||||||
- Do not assume permissions for unrelated cleanup, conflict resolution, merging
|
- Do not assume permissions for unrelated cleanup, conflict resolution, merging
|
||||||
the PR, deleting a branch, or force-pushing any branch other than the current
|
the PR, deleting a branch, or force-pushing any branch other than the current
|
||||||
rebased branch.
|
rebased branch.
|
||||||
@@ -52,13 +78,16 @@ or requested. The Git and PR sequence should have this shape:
|
|||||||
git branch --show-current
|
git branch --show-current
|
||||||
git log --oneline origin/main..HEAD
|
git log --oneline origin/main..HEAD
|
||||||
git diff --stat origin/main...HEAD
|
git diff --stat origin/main...HEAD
|
||||||
# rename with `git branch -m <new-name>` if the name clearly mismatches
|
# rename with `git branch -m <type>/<short-kebab-topic>` if the name clearly mismatches
|
||||||
git fetch origin main
|
git fetch origin main
|
||||||
git rebase origin/main
|
git rebase origin/main
|
||||||
git push origin HEAD
|
git push origin HEAD
|
||||||
# if the rebased branch already exists on origin:
|
# if the rebased branch already exists on origin:
|
||||||
git push --force-with-lease origin HEAD
|
git push --force-with-lease origin HEAD
|
||||||
gh pr create --base main --head "$(git branch --show-current)"
|
# PR 标题和正文使用中文;标题必须以 `feat:`、`fix:` 或 `chore:` 等类型前缀开头
|
||||||
|
gh pr create --base main --head "$(git branch --show-current)" \
|
||||||
|
--title "<type>: <中文标题>" \
|
||||||
|
--body "<中文正文:改动、验证、风险或后续事项>"
|
||||||
```
|
```
|
||||||
|
|
||||||
Do not run the force-with-lease command after a successful ordinary push.
|
Do not run the force-with-lease command after a successful ordinary push.
|
||||||
@@ -70,3 +99,4 @@ Do not run the force-with-lease command after a successful ordinary push.
|
|||||||
- “It is only a typo/urgent fix” does not excuse retaining a clearly mismatched
|
- “It is only a typo/urgent fix” does not excuse retaining a clearly mismatched
|
||||||
branch name or bypassing the PR route.
|
branch name or bypassing the PR route.
|
||||||
- “A merge is quicker” does not replace the required rebase.
|
- “A merge is quicker” does not replace the required rebase.
|
||||||
|
- English PR titles or bodies do not meet this project's PR writing convention.
|
||||||
|
|||||||
Reference in New Issue
Block a user