Now that main is protected, you won't be able to commit and push changes
directly. Instead, you will need to create a feature branch and open a pull
request (PR). In this lab, you will create and review PRs for one another,
following
GitHub flow.
As you've probably noticed by now, the game has a bug where any tiles in the
left- or bottom-most squares do not move. This must be fixed, but we want to
ensure that the fix is reviewed by at least one other person before it is merged
into main.
-
Ensure you're working on the
mainbranchgit checkout main
-
Create a new branch for the fix
git checkout -b fix/stuck-tiles
-
Open
src/application.ts -
Locate the comment
// Lab 7: Grid Size -
Update the input parameter to
GameManagerto5instead of3// Lab 7: Grid Size new GameManager(5)
Note: Updating this to
5is still not the right fix! We're going to do this on purpose to see how we can fix it in a PR. -
Save the file
-
Add the changes to the staging area
git add src/application.ts
-
Commit the changes
git commit -m "Increase grid input size to 5" -
Push your branch to GitHub
git push
-
In your browser, navigate to your repository on GitHub
-
Click on the Pull requests tab
-
Click the New pull request button
-
Click the Compare button, then select your
fix/stuck-tilesbranch -
Click Create pull request
-
Enter a title and description for your PR
-
Click Create pull request
At this point, your PR will not be able to be merged. Someone in the class will need to review it first.
-
Copy the URL of your PR and paste it into the meeting chat
As other people in the class post their PRs, try to review one and provide feedback. In particular, you should suggest a fix to the incorrect grid size that was added in the PR.
-
Click on the link to a PR in the meeting chat
Save this link, as you will need it later to approve the PR.
-
Click the Files changed tab
-
Next to the line that was changed in
src/application.ts, click plus sign (+) to add a comment -
Click the Add a suggestion button to suggest changing the input from
5to4 -
Click Start a review
-
Click Finish your review
-
Add a comment to the PR suggesting the change
-
Ensure Comment is selected as the review type
-
Click Submit review
When someone has reviewed your PR and suggested the change, you should implement it and push the changes to your branch.
- In your browser, navigate to your PR on GitHub
- Scroll down to the comments and locate the one with the suggestion
- Click the Commit suggestion button
- Enter a commit message
- Click Commit changes
Once the author of the PR you reviewed has implemented your suggestion, you should review the PR again and approve it.
-
Open the link to the PR you reviewed previously
-
Click on the Files changed tab
-
Ensure that the suggestion you made is implemented correctly
-
Click the Review changes button
-
Enter a comment
-
Ensure Approve is selected as the review type
-
Click Submit review
Once your PR has been approved, you can merge it into main.
- Click the Merge pull request button
- Click Confirm merge
- Click Delete branch
Congratulations! You've successfully contributed to projects using GitHub flow.
If you're having trouble with any of the steps, you can ask for help in the meeting chat.
The code changes for this lab can be found in the solutions directory.
- Copy the contents of
solutions/7-github-flow/application.tsand replace the contents ofsrc/application.ts



