pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Pull Request

创建Pull Request

Branch Strategy

分支策略

  • Target branch:
    canary
    (development branch, cloud production)
  • main
    is the release branch — never PR directly to main
  • 目标分支
    canary
    (开发分支,云端生产环境)
  • main
    是发布分支 —— 永远不要直接向main提交PR

Steps

步骤

  1. Gather context (run in parallel):
    • git branch --show-current
      — current branch name
    • git rev-parse --abbrev-ref @{u} 2>/dev/null
      — remote tracking status
    • git log --oneline origin/canary..HEAD
      — unpushed commits
    • gh pr list --head "$(git branch --show-current)" --json number,title,state,url
      — existing PR
    • git log --oneline origin/canary..HEAD
      — commit history for PR title
    • git diff --stat --stat-count=20 origin/canary..HEAD
      — change summary
  2. Push if needed:
    • No upstream:
      git push -u origin $(git branch --show-current)
    • Has upstream:
      git push origin $(git branch --show-current)
  3. 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
  4. Create PR with
    gh pr create --base canary
    :
    • Title:
      <gitmoji> <type>(<scope>): <description>
    • Body: based on PR template (
      .github/PULL_REQUEST_TEMPLATE.md
      ), fill checkboxes
    • 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
  5. Open in browser:
    gh pr view --web
  1. 收集上下文(并行运行):
    • git branch --show-current
      — 当前分支名称
    • git rev-parse --abbrev-ref @{u} 2>/dev/null
      — 远程追踪状态
    • git log --oneline origin/canary..HEAD
      — 未推送的提交
    • gh pr list --head "$(git branch --show-current)" --json number,title,state,url
      — 已存在的PR
    • git log --oneline origin/canary..HEAD
      — 用于生成PR标题的提交历史
    • git diff --stat --stat-count=20 origin/canary..HEAD
      — 变更概要
  2. 按需推送代码
    • 无上游分支:
      git push -u origin $(git branch --show-current)
    • 有上游分支:
      git push origin $(git branch --show-current)
  3. 搜索相关GitHub issues
    • gh issue list --search "<keywords>" --state all --limit 10
    • 仅关联范围匹配的issue(避免关联大型总览类issue)
    • 如果未找到匹配的issue则跳过
  4. 使用
    gh pr create --base canary
    创建PR
    • 标题:
      <gitmoji> <type>(<scope>): <description>
    • 正文:基于PR模板(
      .github/PULL_REQUEST_TEMPLATE.md
      ),勾选复选框
    • 使用魔法关键词关联相关GitHub issues(
      Fixes #123
      Closes #123
    • 如适用,关联Linear issues(
      Fixes LOBE-xxx
    • 使用HEREDOC编写正文以保留格式
  5. 在浏览器中打开
    gh pr view --web

PR Template

PR模板

Use
.github/PULL_REQUEST_TEMPLATE.md
as the body structure. Key sections:
  • 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
    ✨ feat/
    or
    🐛 fix
    trigger releases — use carefully
  • 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/
    🐛 fix
    的PR标题会触发发布 —— 请谨慎使用
  • 语言要求:所有PR内容必须为英文
  • 如果当前分支已经存在PR,告知用户即可,不要创建重复PR