3 Review pull requests - selinaZitrone/github_workflow GitHub Wiki
The idea of reviewing a pull request is that the team has the chance to review code
before it is included in the main
branch of the repository.
This can be either used as an opportunity to make suggestions on improvements or simply
as information about what is new in the repository.
Find pull requests to review
You can find a list of all open pull requests in the Github repository on top. Just select the pull request you want to look at by clicking on it.
Navigate the pull request
A pull request has 4 different main sections that you can freely navigate on top:
- Conversation: A summary of the pull request and all comments made to the code. This is the place to write comments and discuss questions and issues
- Commits: A detailed overview of all commits that are part of the pull request. You can go into every commit that was done and review it if you want.
- Checks: A summary of the checks that are run on the pull request. For now this is only an automatic code style check using the
lintr
package. For more details on that look at the Coding guidelines. - Files changed: A comparison of all files before and after the pull request. Here you can see all changes at once and comment on them.
The most important sections for you are the Conversation and Files changed section.
Review changes
Go to the Files changed
section on top. Scroll through the changes that were made.
If you want to comment on specific lines, you can click on the plus sign next to the line and enter your comment or question in the dialogue box that opens:
Enter your comment and then click on Start a review
.
Now you started your personal reviewing process and you can go through all the code and leave as many (or few) comments as you want. You don't have to do this all in one session. You can come back to your review also later.
When you are finished with your review click on Finish your review
in the top right. You can add a final comment to finish your review and you can chose whether your rewiew just provides comments, approves the changes or whether you requests changes to the code before it can be merged.
Then submit your review by clicking on the Submit review
button:
Merge pull request
When the code is discussed and no changes are required anymore, the code can be merged with the main branch. To do this go to the Conversation
section of the pull request and scroll down. Then click on Merge pull request
:
Here you are prompted to enter a commit message for the merge. Provide a descriptive main commit message and some details to make clear what this pull request was doing.
After successfully merging, the branch can now safely be deleted because the changes have now been integrated into the main
branch:
Now everyone in the team can pull the update to the main
branch into their local repositories.