A pull request proposes merging code changes from one branch into another. As a collaborative feature, pull requests give you a place to discuss and review work before it becomes part of a project.
Why use pull requests
Pull requests turn a set of code changes into a conversation. Instead of merging work directly, you propose it so that collaborators can weigh in. This helps you and your team maintain high quality and secure code, in a few ways:
- Catch bugs and problems early, before they reach the main branch.
- Discuss and improve changes together, with feedback tied to specific lines.
- Keep a clear, reviewable history of what changed and why.
What you can do with pull requests
Pull requests make your changes easy to review and validate. With a pull request, you can:
- Propose changes from a branch or a fork.
- Discuss and review the proposed changes, line by line.
- Run automated checks, such as tests, builds, and code scanning, against the changes.
- Respond to feedback and update the pull request as it evolves.
- Merge the changes once reviews and required checks are satisfied.
Key parts of a pull request
A pull request gathers everything you and your reviewers need into one place:
- Conversation shows the description, comments, reviews, and a timeline of activity.
- Commits shows how the branch changed over time.
- Checks shows the results of automated tests, builds, and other validations.
- Files changed shows the diff that reviewers comment on.
- The merge box summarizes whether you can merge your changes or not. It shows what may still need to happen, such as required reviews or checks, before a pull request can be merged.
How pull requests fit your workflow
Whether you're proposing changes or reviewing someone else's, a pull request follows a few stages:
- Branch or fork the repository to create an isolated place to work.
- Commit your changes as you go, building up a history of your work.
- Open a pull request to propose merging your changes into the base branch.
- Review and discuss the changes with collaborators, making updates as needed.
- Merge the pull request when it's ready.