Git Collaboration on GitHub: Forks, Branches, and Pull Requests
GitHub collaboration is the practice of contributing to shared or third-party repositories using Git’s distributed workflow: you fork a repository (copy it to your own account), create a branch for your changes, then open a pull request so the maintainer can review and merge them. Small teams with write access can skip forking and collaborate directly on branches within a shared repository.
In my post “GIT in 10 minutes”, I have covered
the basics of Git setup and a few workflow commands to get started with using Git (version control system).
As promised, I will go into the topic of how to use Git for collaborative work.
Mainly, I will focus on contributions to other repositories, for instance,
open-source or projects of your colleagues and friends.
Let’s go!
GitHub Collaboration Models: Forking vs Shared Repository
As explained in GitHub documentation, GitHub supports two ways of collaborative work:
- Forking. You create a repository fork, which essentially copies a repository to your own
GitHub account. You do not need to have any permissions for the copied repository.
The repository owner can accept your pull request and merge your changes into the original repository.
- Shared repository. In small teams, you can add project collaborators, who usually work on their own
branches and push their contributions directly. Pull requests still let you review the code and comment on proposed changes before merging.
Forking and Pull Requests: Step-by-Step Git Workflow
🔒 Subscribe to keep reading.
Syncing Your Fork with the Upstream Repository
🔒 Subscribe to keep reading.
Shared Repository
🔒 Subscribe to keep reading.
Conclusion: GitHub Collaboration Workflow Summary
🔒 Subscribe to keep reading.
References
🔒 Subscribe to keep reading.
Subscribe to unlock the full article ❤️
Log in to unlock
The form below signs you up for the newsletter. It does not log you into the app — log in afterwards (same email) to unlock this article and download your subscriber gifts. New subscribers get an inbox mail: Set a password to unlock articles.
Full content temporarily unavailable — refresh in a moment