Skip to content

Latest commit

 

History

History
78 lines (52 loc) · 6.85 KB

File metadata and controls

78 lines (52 loc) · 6.85 KB
title intro redirect_from versions topics
About pull requests
Learn about pull requests and draft pull requests on {% data variables.product.product_name %}. Pull requests communicate changes to a branch in a repository. Once a pull request is opened, you can review changes with collaborators and add follow-up commits.
/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
/articles/using-pull-requests
/articles/about-pull-requests
/github/collaborating-with-issues-and-pull-requests/about-pull-requests
/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
fpt ghes ghec
*
*
*
Pull requests

About pull requests

A pull request is a proposal to merge a set of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they integrate the changes into the main codebase. Pull requests display the differences, or diffs, between the content in the source branch and the content in the target branch.

{% note %}

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.
  • Be very careful when force pushing commits to a pull request. Force pushing changes the repository history and can corrupt your pull request. If other collaborators branch the project before a force push, the force push may overwrite commits that collaborators based their work on.

{% endnote %}

You can create pull requests on {% data variables.product.prodname_dotcom_the_website %}, with {% data variables.product.prodname_desktop %}{% ifversion fpt or ghec %}, in {% data variables.product.prodname_github_codespaces %}{% endif %}, on {% data variables.product.prodname_mobile %}, and when using GitHub CLI.

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. See "AUTOTITLE."

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. {% ifversion pull-request-approval-limit %}{% data reusables.pull_requests.code-review-limits %}{% endif %}

{% ifversion fpt or ghec %} You can see information about the branch's current deployment status and past deployment activity on the "Conversation" tab. See "AUTOTITLE." {% endif %}

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. See "AUTOTITLE."

{% data reusables.pull_requests.required-checks-must-pass-to-merge %}

{% data reusables.pull_requests.close-issues-using-keywords %}

{% tip %}

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 "AUTOTITLE."
  • You can squash commits when merging a pull request to gain a more streamlined view of changes. See "AUTOTITLE."

{% endtip %}

You can visit your dashboard to quickly find links to recently updated pull requests you're working on or subscribed to. See "AUTOTITLE."

Draft pull requests

{% data reusables.gated-features.draft-prs %}

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. See "AUTOTITLE" and "AUTOTITLE."

{% data reusables.pull_requests.mark-ready-review %} You can convert a pull request to a draft at any time. See "AUTOTITLE."

Differences between commits on compare and pull request pages

The compare and pull request pages use different methods to calculate the diff for changed files:

  • Compare pages show the diff between the tip of the head ref and the current common ancestor (that is, the merge base) of the head and base ref.
  • Pull request pages show the diff between the tip of the head ref and the common ancestor of the head and base ref at the time when the pull request was created. Consequently, the merge base used for the comparison might be different.

Further reading