Forking Workflow in Open Source Ecosystem
Last Updated :
14 Jun, 2024
In the Open Source ecosystem, Git and Github are widely used for efficiently managing large projects and collaborating with other developers worldwide. Hence a general Forking Workflow is followed by every developer who is contributing to these Open Source Projects. So let’s deep dive to look at how exactly this Working by Forking works in an Open Source Ecosystem.
Forking a repository and Cloning it in the local environment
Just visit the Open Source Project’s Github page you want to contribute, then after choosing the particular repository just click on the `Fork` button situated at the top right corner. Now that you have created your own copy of that repository by forking it, let’s clone your forked repository in the local machine by running the following command:
command: git clone https://github.com/your_username/forked_project.git
example: git clone https://github.com/Aniruddha-Shriwant/techdocs.git
Adding ‘upstream’ repository to the list of remotesĀ
Upstream is a repository from where you have forked your local copy of the project. Now to keep your fork up to date and to sync it with the original ‘upstream’ repository let’s add a new remote named upstream:
git remote add upstream https://github.com/accordproject/techdocs.git
You can verify the remote by running theĀ
git remove -v

Fetching from upstream remoteĀ
To update your fork with the latest upstream changes, you will need to fetch the upstream repo’s branches and its latest commits using the git fetch command
git fetch upstream
Now check out to your own master branch and merge upstream repo’s master branch:
git checkout master
git merge upstream/master
Now your local master branch is up to date with everything updated upstream.
Creating a new branch
Whenever you begin working on a new feature/bug fix, it’s important to create a separate new branch not only because it’s a proper git etiquette but you can keep your changes separate from the master branch and can easily manage multiple pull requests submitted. To create a new branch, checkout to master branch first as we want our new branch to come from the master branch and then create your new branch and edit your changes accordingly
git checkout master
git checkout -b yourNewBranch //This command will create a new branch and then checkout in it
Rebasing your branch before making Pull Request
While working on your development branch if any new commits are made in the upstream’s master branch then you will need to rebase your branch so that maintainers can merge your PullRequest easily and any conflicts would be avoided in advance.
Fetch upstream master and then merge it with your local repository’s master branch:
git fetch upstream
git checkout master
git merge upstream/master
Rebase your development branch with the master branch:
git checkout yourNewBranch // yourNewBranch = your development branch that you have created earlier
git rebase master
After rebasing your branch you are ready to push those changes and create a Pull Request on Github.
Conclusion
To conclude, Mastering this workflow etiquette will help you in your Open Source journey and you won’t face any issues which beginner faces while making their contributions to Open Source Projects.
Similar Reads
Git Workflows With Open Source Collaboration
Open source is a space where people can modify and design something that is publiclycaly accessible to everyone. Software or codebases that are open source facilitate collaboration and innovation, which is not just limited to a team, but the whole public. GitHub is a platform that houses a wide rang
10 min read
How to Contribute to Open Source?
Contributing to open-source projects is a rewarding way to enhance your skills, gain practical experience, and give back to the developer community. Open-source projects welcome contributions from developers of all levels, and getting started is easier than you might think. In this article, we will
10 min read
Everything You Need to Know About Open Source Development
Open source development is a collaborative approach to software development where the source code is made publicly available. This model allows anyone to view, modify, and distribute the code, that can lead to high-quality, innovative software. In this article, we will explore what open source devel
9 min read
Git Workflows For Agile Development Teams
Git Flow is a branching model that involves the use of different types of branches based on the objective of the task. Table of Content The Git Flow strategy consists of the following branchesAgile Development LifecycleSteps to Integrate Git In Your Agile Workflow Choosing the Right Git WorkflowBene
6 min read
Advance Git Sheet For Open Source Contributors
Contributing to open-source projects is a fantastic way to enhance your coding skills, collaborate with a large community, and give back to the tech world. However, navigating Git can be challenging for many. This advanced Git cheat sheet aims to equip open-source contributors with essential command
4 min read
How Git Changed Open Source?
Git, the distributed version control system created by Linus Torvalds in 2005, has fundamentally transformed the way open-source projects are developed, managed, and maintained. Before Git, version control systems were either centralized or less capable of handling the complex workflows that open-so
6 min read
Making your first Open Source Pull Request | Github
Open Source softwares are softwares for which the original source code is made freely available and may be redistributed and modified. As a Programmer, we are more interested in how to contribute to their codebase. A lot of newcomers find Open Source to be dreadful and daunting. But worry not, every
3 min read
Why Every Team Needs a Git Workflow Strategy?
Git, the most popular version control system, offers powerful tools for managing code, tracking changes, and enabling collaboration across teams. However, the true power of Git can only be harnessed when teams adopt a clear and consistent Git workflow strategy. A Git workflow strategy outlines how t
7 min read
Using Git Worktrees for Multiple Working Directories
Git worktrees are a powerful but often underutilized feature of Git that allows you to have multiple working directories associated with a single Git repository. This enables you to work on multiple branches simultaneously without the hassle of constantly switching or creating separate clones of the
4 min read
Git Workflow Etiquettes
Version control systems like Git have revolutionized the way developers collaborate on projects. However, efficient collaboration depends on sticking to certain manners that streamline the workflow and ensure code quality. Here are some important Git workflow etiquettes to follow. Table of Content 1
2 min read