In this hands-on lab you will learn how to perform reviews of code, make suggestions, and approve pull requests. The module consists of the following parts:
- Open pull the request and add a single comment
- Incorporate the changes and set PR to autocomplete
- Performing a review
- Reconciling your local repository
Note:
⚡ In this this exercise you have to work together with the same partner that you added as a reviewer to your PR in Collaborate on code. The first part is in the repo of your partner. The second one in your own after the parter completed that aprt. The third one again in the repo of your partner. Make sure that you always pick the right repository!
Note:
⚡ This part is done in the repo of your execise partner!
- Open the PR of your partner - you should have received a notification.
- Go to the
Filles changed
tab and click line 78. Drag the mouse to line 79 - this will select two lines. - Add a
suggestion
and increase the decrement to 0.006:
Note:
⚡ This part is done in YOUR repo!
- Go back to your repo and wait for your partner to complete the comment with the suggestion.
- Open
Commit suggestion
and verify the commit message title and body. ClickCommit changes
:
- Note that the commit shows up under
commit
tab and contains your partner as a co-commiter:
- Now set
Enable auto-merge
toSquash and merge
and enable it:
- Verify the commit message with all changes and the co-author information and confirm the auto-merge:
- Check that auto-merge is enabled and head over to the repo of your partner:
Note:
⚡ This part is done in the repo of your execise partner!
- Open the PR again and note that the changes you had suggested are now visible. Add a new comment and this time start a review:
- You could add multiple comments and the indicator on the top of the PR will increase. If ready, finish the review and approve it:
- Note that the PR gets automatically merged after you have approved the PR. Also the branch was deleted automatically.
Verify that your own pull request is also merged. Go back to your command line and clean up your local repo:
- Switch to the main branch:
git switch main
- Pull the changes with
--prune
or-p
to delete branches do not longer exist on the remote:
git pull --prune
The result should look like this:
$ git switch main
> Switched to branch 'main'
> Your branch is behind 'origin/main' by 2 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
$ pull --prune
> From https://github.com/wulfland/GitHubBootcamp
> - [deleted] (none) -> origin/users/wulfland/1_fix-game
> remote: Enumerating objects: 20, done.
> remote: Counting objects: 100% (20/20), done.
> remote: Compressing objects: 100% (14/14), done.
> remote: Total 14 (delta 10), reused 0 (delta 0), pack-reused 0
> Unpacking objects: 100% (14/14), 3.15 KiB | 247.00 KiB/s, done.
> bbc4b93..57023b8 main -> origin/main
> Updating d7076e3..57023b8
> Fast-forward
docs/index.html | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
- Check that the issue was automatically closed when the PR was merged
- Check that the bug was fixed and your game is working
In this hands-on lab you've learned how to perform code reviews, make and incorporate suggestions, and approve pull requests.
You can now continue with CI/CD and Automation.