4.5. Making and Approving Pull Requests
Completion requirements
Go through the activity to the end
GitHub: Pull Requests (PR)
Pull requests (often referred to as simply a 'PR') are a way to merge changes from a new branch into the main branch.
- They allow teams to review and either accept or reject new changes
- Powerful tool to help prevent new changes from breaking old code
- Can also run regression tests in GitHub CI (Continuous Integration)
- For more info on GitHub CI, see the official documentation.
Making a Pull Request
Pull requests rely on an official codebase. There are two different ways that a user can make a pull request:
- Within the same repository, using another branch:
- Create a new branch directly within the original repository, make your changes on this branch, and then open a PR from the new branch into the main branch of the same repository.
- ★ Use Case: Teams with write access to a repository.
- From a fork of the repository:
- Fork the main repository to your own GitHub account, create a new branch in your fork, make changes, and then open a PR from that fork back to the original repository.
- ★ Use Case: Open source contributions where a contributor does not have write access to the main repository.
In both cases, the user works independently, and when changes are ready to be implemented, they submit a pull request.
The repo maintainers are always responsible for reviewing and approving changes before merging into the official main branch.