Collaboration is an essential part of software development — whether with a small team, or a global community in the open-source space.
Apologies in advance to the non-technical subset of this audience because this month I want to share some tips & insights that have helped me feel confident navigating the world of open-source.
Git hosting services
Open-source projects can have hundreds of contributors from around the world, and are typically hosted on platforms like GitHub or GitLab. These platforms offer features that sit on top of vanilla Git—like permissions and collaboration tools.
However, the key thing to know about these services is that behind-the-scenes the hard work is done by Git itself. Managing file changes, branching, merging, and even interfacing with remote repositories can all be done entirely with Git through your command-line. In fact, hosting Git repositories on personal servers rather than a corporate cloud provider (like GitHub or GitLab) is probably more aligned with the ethos of open-source.
That being said, these hosting services streamline certain workflows and can make collaboration using Git easier. Features like repository read/write permissions, discussion forums, and code review tools are advantageous when we're talking about making Git projects accessible to a global audience. That's why the rest of this newsletter will focus on Git collaboration using these hosting services.
For a high-level explanation of Git hosting services see this video.
The Forking Workflow
After an open-source repository is uploaded to a hosting service, giving every contributor write access to that repository (also called the "upstream") would be far too chaotic. That’s why the core team protects the upstream repository with read-only access for outsiders. Only trusted maintainers can directly modify it. So, in order to create a safe path for contributions, potential collaborations start by forking this upstream repository.
When you fork a repository, you create a server-side clone of it under your own account. You have full control over this new copy—you can modify it, push to it, and even delete it.
Importantly though, the fork retains a connection to the original upstream repository. This relationship enables a powerful workflow: you can make changes to your fork, then open a pull request asking the original maintainers to review and merge your contributions.
This model is essential for open-source collaboration. It keeps the original repository protected, while still allowing outside developers to contribute.
Pull Requests
A pull request is a polite request to "pull" your changes into a repository owned by someone else. Pull requests also act as code review tools.
Project maintainers and others in the community can:
- View each commit and line of code you changed.
- Ask questions or request improvements.
- Discuss your contribution and share ideas.
If everything looks good, the core maintainer group can merge the changes from your fork into the upstream repository.
Congratulations, your contributions are now part of the main project.
I realize written explanations of these workflows might not be the best medium. For my non-LearnGit.io members, check out the YouTube video from my channel, The Modern Coder, below:
Fork & Clone: The Definitive Guide
In this video we explore cloning, forking, and pull requests. Go behind-the-scenes of these two operations, and learn how these operations work together to enable collaboration within the open-source community. Watch now on YouTube.
|
To dig even deeper, and understand other related mechanics such as remote-tracking branches, pushing, pulling fetching etc. check out the following lessons on LearnGit.io — the entrepreneurial venture I started last year.
LearnGit.io Collaboration Module
In this 13 lesson module learn to sync work between local and remote repositories. Push uncover the clone, fetch, push and pull operations, along with using SSH for secure communication, remote-tracking branches, forked repositories, open-source, code review and pull requests.
|
Thanks again for reading. If you have any questions, or just want to get in touch, hit reply.
Cheers,