“Developer Team Collaboration” Exercise
Learning Objectives
Adopt a Pull Request Workflow to collaborate with teammates, on team projects where you have write access to the repository.
Instructions
For teams who want everyone to have write access to the same shared repo, see the process below:
- Create a new repo under your own control and invite other members as collaborators, or join an existing repo that someone else has invited you to collaborate on.
- Clone the repo locally if you haven’t already done so. Ensure your local main branch is up-to-date with the origin main branch.
- Checkout a new local feature branch called something like “[USERNAME]-new-feature-123”. We include the username in the branch name so our branch names will stay unique and not conflict with other people’s branches.
- Modify some part of the codebase (for this exercise, the change we’ll make is to add a new file called “[USERNAME].md”, with some example markdown contents inside), then save your work, and make a commit on the local feature branch.
- Push the local feature branch revisions to the origin repo.
- Create a Pull Request to compare the feature branch changes against the main branch.
- Ask a repo collaborator to conduct a Code Review on your Pull Request.
- Wait until a collaborator takes further action - reviewing your code and hopefully eventually approving your changes. After approving the changes, either you or a collaborator can merge the code via the GitHub interface.
To repeat the process (after changes have been merged):
- After the changes have been merged to the upstream repo, visit your origin repo on GitHub and click “Fetch Upstream” to update your origin main branch.
- Using your Git Client, checkout the main branch, and pull the most recent changes from the origin main branch.
- Then repeat steps 3-8 above.