# 使用查询参数创建拉取请求

使用查询参数创建自定义 URL，这些 URL 使用预先填充的标题、说明、标签等打开拉取请求。

可以将查询参数添加到比较 URL，以打开具有预填充字段的拉取请求。 有关拉取请求模板，请参阅 [为仓库创建拉取请求模板](/zh/enterprise-server@3.22/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository)。

| 参数           | Purpose                                                             | Example                                                                                                            |
| ------------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `quick_pull` | 打开比较分支的“打开拉取请求”页。                                                   | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1`                                      |
| `title`      | 添加拉取请求标题。 用于 `+` 空格。                                                | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&labels=bug&title=Bug+fix`             |
| `body`       | 将文本添加到拉取请求正文。 用于 `+` 空格。                                            | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&title=Bug+fix&body=Describe+the+fix.` |
| `labels`     | 添加一个或多个标签。 使用逗号分隔多个标签。                                              | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&labels=help+wanted,bug`               |
| `milestone`  | 添加里程碑。 用于 `+` 空格。                                                   | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&milestone=testing+milestones`         |
| `assignees`  | 将拉取请求分配给一个或多个用户。 用逗号分隔多个用户。                                         | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&assignees=octocat`                    |
| `projects`   | 将拉取请求添加到项目。                                                         | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&title=Bug+fix&projects=octo-org/1`    |
| `template`   | 从 `PULL_REQUEST_TEMPLATE` 根 `docs/`目录或 `.github/` 目录中的子目录中添加拉取请求模板。 | `https://github.com/octo-org/octo-repo/compare/main...my-branch?quick_pull=1&template=issue_template.md`           |

必须具有完成等效操作以使用其查询参数的权限。 例如，必须具有添加要使用的标签 `labels`的权限。 请参阅“[组织的存储库角色](/zh/enterprise-server@3.22/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization)”。

无效的查询参数或权限不足返回错误 `404 Not Found` 。 超过服务器限制的 URL 返回错误 `414 URI Too Long` 。