SuperAPI AI Directory

gh-create-pr

Coding & development

View repository

Updated 10-15 19:56

About this skill

Use gh to create / update a PR

When to use

  • The user says: 提 PR, 新建 PR, 用 gh 建 PR, submit PR, create pull request, 开 PR
  • The current branch has unpushed commits and needs to be pushed to origin and a PR created or updated

Procedure

1. Check status

git status -sb
git log -1 --oneline
  • If there are uncommitted changes, commit them first according to the project conventions (see "Commit message conventions" below).
  • If [ahead N], you need to push first.

2. Push the current branch

If the current branch is ahead of origin:

git push -u origin <当前分支名>

Or the shorthand (when the current branch already tracks origin):

git push origin

3. Create the PR

gh pr create --base main --head <当前分支名> --title "<标题>" --body "<正文>"
  • --base: the target branch, usually main or master, which can match the repository's default branch.
  • --head: the current branch; if omitted, gh uses the currently checked-out branch.
  • If the branch already has an open PR, gh will indicate that it already exists and provide a link, and will not create a duplicate.

4. Title and body

  • Title: a brief description of the changes, which can match the summary of the most recent commit or be slightly summarized.
  • Body: optional; can include "Change description", "Testing description", "Related Issue", etc. If the user does not specify, a concise template can be used, for example:
## 变更说明

- (根据 commit 或改动简要列出)

> Submitted by Cursor

Commit message conventions (this repository)

When committing, follow the existing conventions:

  • Format:Component: Emoji 描述 or type(scope): description
  • Use backticks for Props and component names; add spaces between Chinese and English
  • Write multiple types of changes as separate items by component/type

Example:MarkdownEditor: 优化 Jinja 模板(可访问性、错误处理、样式与单测)

Command quick reference

Step Command
Check status git status -sb
Push git push -u origin $(git branch --show-current)
Create PR gh pr create --base main --title "标题" --body "正文"
View existing PR gh pr list --head $(git branch --show-current)

Notes

  • Before running gh , you must already be logged in:gh auth login。
  • If you encounter a TLS / certificate error, try again with required_permissions: ["all"] .
  • Creating a PR requires network permission.