You already know how to merge changes from one branch to another on your local Git repository.
To do the same thing on GitHub, you would need to open a Pull Request (or a Merge Request if you are using GitLab) or a PR for short and request a merge from your feature branch to the
The steps that you would need to take to open a Pull Request are:
- If you are working on an open-source project that you are not the maintainer of, first fork the repository as per chapter 21. Skip this step if you are the maintainer of the repository.
- Then clone the repository locally with the
git clone firstname.lastname@example.org:your_user/your_repo
- Create a new branch with the
git checkout -b branch_name
Make your code changes
Stage the changes with
git add .
- And then commit them with
git commit -m "Commit Message"
- Then push your new branch to GitHub with
git push origin branch_name
- After that, visit the repository on GitHub and click on the
Pull Requestsbutton and then click on the green
New pull requestbutton:
- In there, choose the branch that you want to merge to and the branch that you want to merge from:
- Then review the changes and add a title and description and hit the create button
- If you are working on a project with multiple contributors, make sure to select a few reviewers. Essentially reviewers are people who you would like to review your code before it gets merged to the
For a visual representation of the whole process, make sure to check out this step by step tutorial as well: