pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Pull Request
创建Pull Request
Branch Strategy
分支策略
- Target branch: (development branch, cloud production)
canary - is the release branch — never PR directly to main
main
- 目标分支:(开发分支,云端生产环境)
canary - 是发布分支 —— 永远不要直接向main提交PR
main
Steps
步骤
-
Gather context (run in parallel):
- — current branch name
git branch --show-current - — remote tracking status
git rev-parse --abbrev-ref @{u} 2>/dev/null - — unpushed commits
git log --oneline origin/canary..HEAD - — existing PR
gh pr list --head "$(git branch --show-current)" --json number,title,state,url - — commit history for PR title
git log --oneline origin/canary..HEAD - — change summary
git diff --stat --stat-count=20 origin/canary..HEAD
-
Push if needed:
- No upstream:
git push -u origin $(git branch --show-current) - Has upstream:
git push origin $(git branch --show-current)
- No upstream:
-
Search related GitHub issues:
gh issue list --search "<keywords>" --state all --limit 10- Only link issues with matching scope (avoid large umbrella issues)
- Skip if no matching issue found
-
Create PR with:
gh pr create --base canary- Title:
<gitmoji> <type>(<scope>): <description> - Body: based on PR template (), fill checkboxes
.github/PULL_REQUEST_TEMPLATE.md - Link related GitHub issues using magic keywords (,
Fixes #123)Closes #123 - Link Linear issues if applicable ()
Fixes LOBE-xxx - Use HEREDOC for body to preserve formatting
- Title:
-
Open in browser:
gh pr view --web
-
收集上下文(并行运行):
- — 当前分支名称
git branch --show-current - — 远程追踪状态
git rev-parse --abbrev-ref @{u} 2>/dev/null - — 未推送的提交
git log --oneline origin/canary..HEAD - — 已存在的PR
gh pr list --head "$(git branch --show-current)" --json number,title,state,url - — 用于生成PR标题的提交历史
git log --oneline origin/canary..HEAD - — 变更概要
git diff --stat --stat-count=20 origin/canary..HEAD
-
按需推送代码:
- 无上游分支:
git push -u origin $(git branch --show-current) - 有上游分支:
git push origin $(git branch --show-current)
- 无上游分支:
-
搜索相关GitHub issues:
gh issue list --search "<keywords>" --state all --limit 10- 仅关联范围匹配的issue(避免关联大型总览类issue)
- 如果未找到匹配的issue则跳过
-
使用创建PR:
gh pr create --base canary- 标题:
<gitmoji> <type>(<scope>): <description> - 正文:基于PR模板(),勾选复选框
.github/PULL_REQUEST_TEMPLATE.md - 使用魔法关键词关联相关GitHub issues(、
Fixes #123)Closes #123 - 如适用,关联Linear issues()
Fixes LOBE-xxx - 使用HEREDOC编写正文以保留格式
- 标题:
-
在浏览器中打开:
gh pr view --web
PR Template
PR模板
Use as the body structure. Key sections:
.github/PULL_REQUEST_TEMPLATE.md- Change Type: Check the appropriate gitmoji type
- Related Issue: Link GitHub/Linear issues with magic keywords
- Description of Change: Summarize what and why
- How to Test: Describe test approach, check relevant boxes
使用作为正文结构。核心章节:
.github/PULL_REQUEST_TEMPLATE.md- 变更类型:勾选对应的gitmoji类型
- 相关Issue:使用魔法关键词关联GitHub/Linear issues
- 变更描述:概述变更内容和原因
- 测试方式:描述测试方法,勾选相关选项
Notes
注意事项
- Release impact: PR titles with or
✨ feat/trigger releases — use carefully🐛 fix - Language: All PR content must be in English
- If a PR already exists for the branch, inform the user instead of creating a duplicate
- 发布影响:带有或
✨ feat/的PR标题会触发发布 —— 请谨慎使用🐛 fix - 语言要求:所有PR内容必须为英文
- 如果当前分支已经存在PR,告知用户即可,不要创建重复PR