Practice 6: Project collaboration in GitHub
By the end of this practice, you will know how to use GitHub to:
- Create, assign and close issues
- Create, review, close pull requests
- Organise issues into project boards
- Create wiki pages
Last practice
A lot of students encountered the same problem at the last practice: not commiting often enough. The description of the exercise purposefully didn't tell you when to commit to show you the importance of knowing what state your repository is in and of committing often. As a rule of thumb, you should make a new commit whenever you make a separate, independent change. For example, adding a file (answers.txt) or adding content (adding answers to the file).
There is no need to do a git push
after each commit. This allows you to review your commits before pushing in the future. If you decide that there are too many and commits are too small, you can use git rebase
tool that we used in week 3 to edit them or _squash_ multiple commits into one commit with a new commit message.
Remember to use git status
often, to see exactly what files you have changed and what changes are staged to go into next commit and commit often to avoid the problems you might have encountered last time and prevent data loss.
Project collaboration
This time you will all be working on the same repository again. Clone the repository and get familiar with it. What files are there? What isues are there? What branches are there?
Documentation
Go to the wiki page of the repository and create a new page for yourself. Edit the wiki home page and add the link to your page under the list of other pages.
Picking an issue
Pick one issue from the issue list. Make sure that it is not assigned to anyone and then assign it to yourself. All issues have you make a small change in the code. No previous knowledge of coding is required, most issues describe the exact change you have to make.
Go to the project board of the repository and add the card for the issue you're working on to the "In progress" column. Whenever the status of your issue is updated, move the card to the appropriate column.
Write about the issue you picked on your wiki page. What is the ID and title of your issue?
Fixing the issue
Move your card to the "in progress" column.
Create a separate branch for your fix. Do the changes required by your issue and commit them to that branch.
Write about the solution on your wiki page. What change was required of you and how did you do it?
Opening a pull request
Push your branch to the repository.(NB! If you don't have access to push to the repository, check your e-mail for an invitation. If it still doesn't work, ask the instructor to give you access). Remember, when pushing a new branch to a remote repository, you need to specify exactly what remote and what branch you want to push to (for example, if my branch is "branch-3" and my remote is "origin", I need to run git push origin branch-3
).
Go to the GitHub page of the repository and open a new pull request for your branch. In the description of the pull request, write the syntax that would automatically close the issue that you are working on when the pull request is approved. For example, if the ID of my issue is 123, I would write "Closes #123".
Assign one of your classmates or the instructor (@Stopa) to review your pull request. The reviewer will receive a notification on their GitHub account, but it's better to inform them directly and ask them to review your branch.
Move the card of your issue into the "done" column in the project board.
Add a link to your pull request on your wiki page. Write who you assigned as a reviewer.
Code review
When someone assigns you as the reviewer of their pull request. If everything seems OK, Close and merge the pull request, otherwise request changes.
Write about the review on your wiki page. What issue were you asked to review? What changes did the author do? Was it OK or did you ask for changes?
Finishing touches
Create a new issue for the instructor to review your work. Add the link to your wiki page in the description. Label it as "help wanted" and assign it to the instructor (@Stopa).