List of exercises
Full list
This is a list of all exercises and solutions in this lesson, mainly as a reference for helpers and instructors. This list is automatically generated from all of the other pages in the lesson. Any single teaching event will probably cover only a subset of these, depending on their interests.
Collaborating within the same repository
Practicing code review
Exercise: Practicing code review (25 min)
Technical requirements:
If you create the commits locally: Being able to authenticate to GitHub
What is familiar from previous episodes:
Creating a branch (previous lesson)
Committing a change on the new branch (previous lesson)
Opening and merging pull requests (previous lesson)
What will be new in this exercise:
As a reviewer, we will learn how to ask for changes in a pull request.
As a reviewer, we will learn how to suggest a change in a pull request.
As a submitter, we will learn how to modify a pull request without closing the incomplete one and opening a new one.
Exercise tasks:
Create a new branch and one or few commits: in these improve something but also deliberately introduce a typo and also a larger mistake which we will want to fix during the code review.
Open a pull request towards the main branch.
As a reviewer to somebody else’s pull request, ask for an improvement and also directly suggest a change for the small typo. (Hint: suggestions are possible through the GitHub web interface, view of a pull request, “Files changed” view, after selecting some lines. Look for the “±” button.)
As the submitter, learn how to accept the suggested change. (Hint: GitHub web interface, “Files Changed” view.)
As the submitter, improve the pull request without having to close and open a new one: by adding a new commit to the same branch. (Hint: push to the branch again.)
Once the changes are addressed, merge the pull request.
How to contribute changes to repositories that belong to others
Recovery
But if you want to keep your local changes, you can change the remote URL to point to your fork.
Check where your remote points to with git remote --verbose
.
It should look like this (replace USER
with your GitHub username):
$ git remote --verbose
origin git@github.com:USER/forking-workflow-exercise.git (fetch)
origin git@github.com:USER/forking-workflow-exercise.git (push)
It should not look like this:
$ git remote --verbose
origin git@github.com:cr-workshop-exercises/forking-workflow-exercise.git (fetch)
origin git@github.com:cr-workshop-exercises/forking-workflow-exercise.git (push)
In this case you can adjust “origin” to point to your fork with:
$ git remote set-url origin git@github.com:USER/forking-workflow-exercise.git