create-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Pull Request

创建拉取请求(Pull Request)

Creates GitHub pull requests with properly formatted titles using the project's PR template.
Do not add "Co-Authored-By", "Generated with" or any type of references to the AI model unless explicitly instructed by the user.
创建标题格式规范的GitHub拉取请求,使用项目的PR模板。
除非用户明确指示,否则请勿添加“Co-Authored-By”、“Generated with”或任何提及AI模型的内容。

Workflow

工作流程

Step 1: Check for staged changes

步骤1:检查暂存的变更

If there are staged changes, use the
git-commit
skill to commit them first:
bash
git status
If staged changes exist, invoke the git-commit skill.
如果存在暂存的变更,请先使用
git-commit
技能提交它们:
bash
git status
若存在暂存变更,调用git-commit技能。

Step 2: Analyze current branch state

步骤2:分析当前分支状态

Run these commands to understand the changes:
bash
git status
git diff --stat
git log origin/master..HEAD --oneline
Note: The base branch may be
main
or
master
- check which exists.
运行以下命令以了解变更情况:
bash
git status
git diff --stat
git log origin/master..HEAD --oneline
注意:基准分支可能是
main
master
——请检查哪个分支存在。

Step 3: Determine PR title

步骤3:确定PR标题

Analyze the commits to create a properly formatted PR title:
  • Use imperative present tense: "Add" not "Added"
  • Capitalize the first letter
  • No period at the end
  • No ticket IDs (e.g., MGX-1234)
Examples:
  • "Add user authentication flow"
  • "Fix memory leak in worker process"
  • "Update API endpoint documentation"
分析提交记录以创建格式规范的PR标题:
  • 使用祈使语气现在时:用“Add”而非“Added”
  • 首字母大写
  • 结尾无句号
  • 不包含工单ID(例如MGX-1234)
示例:
  • "Add user authentication flow"
  • "Fix memory leak in worker process"
  • "Update API endpoint documentation"

Step 4: Push changes

步骤4:推送变更

Push the current branch to origin. Do not use
--force
. If the push fails, stop and return control to the user.
bash
git push -u origin HEAD
将当前分支推送到origin。请勿使用
--force
参数。如果推送失败,请停止操作并将控制权交还给用户。
bash
git push -u origin HEAD

Step 5: Create PR using gh CLI

步骤5:使用gh CLI创建PR

Check if a PR template exists at
.github/pull_request_template.md
or
.github/PULL_REQUEST_TEMPLATE.md
.
If a template exists, read it and use it as the PR body.
Create the PR:
bash
gh pr create --title "<PR_TITLE>" --body "<PR_BODY>"
If no template exists, create a PR with a basic body summarizing the changes.
检查
.github/pull_request_template.md
.github/PULL_REQUEST_TEMPLATE.md
是否存在PR模板。
如果模板存在,请读取并将其用作PR正文。
创建PR:
bash
gh pr create --title "<PR_TITLE>" --body "<PR_BODY>"
如果不存在模板,创建一个包含变更摘要的基础版PR正文。