“Open Source Collaboration” Exercise
Learning Objectives
Adopt and practice a Pull Request Workflow to collaborate with people you don’t know, on open source projects where you don’t have write access to the repository.
Instructions
This is the process we will follow to add or revise the functionality of repos we don’t own or have write access to:
- Choose a repo owned by someone else, that you don’t have direct write access to (i.e. the “upstream” repo).
- Fork the upstream repo to create a copy under your own control (i.e. the “origin” repo).
- Clone the origin repo locally. Ensure your local main branch is up-to-date with the upstream and origin main branches.
- Checkout a new local feature branch called something like “new-feature-123”.
- 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 origin feature branch changes against the upstream main branch.
- Wait until a maintainer of the upstream repo takes further action - eventually hopefully merging your code into the upstream main branch.
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 upstream main branch.
- Then push those changes to the origin main branch, to ensure it is up-to-date with the upstream main branch.
- Then repeat steps 4-8 above.