👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.


我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 将停止服务 此版本的 GitHub Enterprise 已停止服务 2020-08-20. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

文章版本: Enterprise Server 2.18

About pull requests

Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub Enterprise. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

本文内容

Were you able to find what you were looking for?

About pull requests

Note: When working with pull requests, keep the following in mind:

  • If you're working in the shared repository model, we recommend that you use a topic branch for your pull request. While you can send pull requests from any branch or commit, with a topic branch you can push follow-up commits if you need to update your proposed changes.
  • When pushing commits to a pull request, don't force push. Force pushing can corrupt your pull request.

After initializing a pull request, you'll see a review page that shows a high-level overview of the changes between your branch (the compare branch) and the repository's base branch. You can add a summary of the proposed changes, review the changes made by commits, add labels, milestones, and assignees, and @mention individual contributors or teams. For more information, see "Creating a pull request."

Once you've created a pull request, you can push commits from your topic branch to add them to your existing pull request. These commits will appear in chronological order within your pull request and the changes will be visible in the "Files changed" tab.

Other contributors can review your proposed changes, add review comments, contribute to the pull request discussion, and even add commits to the pull request.

After you're happy with the proposed changes, you can merge the pull request. If you're working in a shared repository model, you create a pull request and you, or someone else, will merge your changes from your feature branch into the base branch you specify in your pull request. For more information, see "Merging a pull request."

如果需要对仓库进行状态检查,必须通过所需的状态检查后,您才可将分支合并到受保护分支。 更多信息请参阅“关于必要的状态检查”。

您可以将拉取请求链接到议题,以便在有人合并拉取请求时自动关闭议题。 更多信息请参阅“将拉取请求链接到议题”。

Tips:

  • To toggle between collapsing and expanding all outdated review comments in a pull request, hold down optionAltAlt and click Show outdated or Hide outdated. For more shortcuts, see "Keyboard shortcuts."
  • You can squash commits when merging a pull request to gain a more streamlined view of changes. For more information, see "About pull request merges."

You can visit your dashboard to quickly find links to recently updated pull requests you're working on or subscribed to. For more information, see "About your personal dashboard."

Draft pull requests

Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team, GitHub Enterprise Server 2.17+, and GitHub Enterprise Cloud.

When you create a pull request, you can choose to create a pull request that is ready for review or a draft pull request. Draft pull requests cannot be merged, and code owners are not automatically requested to review draft pull requests. For more information about creating a draft pull request, see "Creating a pull request" and "Creating a pull request from a fork."

准备获取对拉取请求的反馈时,可将拉取请求草稿标记为可供审查。 将拉取请求标记为可供审查将要求任何代码所有者进行审查。 You can convert a pull request to a draft at any time. For more information, see "Changing the stage of a pull request."

Further reading

Were you able to find what you were looking for?

问问别人

找不到要找的内容?

联系我们