A fork is a new repository that shares the original “upstream” repository’s code and visibility settings. Forks are frequently used in open-source projects or when a user does not have write access to the upstream repository to iterate on ideas or changes before they are proposed back to the upstream repository.
What is GitHub Repository Forking?
Assume you enjoy working on a specific framework or library. You discover a way to improve the functionality of this framework yourself one day.
The source code is available as a public repository on GitHub, so you can fork it to make a local copy.
Once you have a local copy of the code, you can make the necessary changes and request that the community review them.
Following a review of your code changes, the community may approve them or request additional changes. They are most likely to accept your code changes after they have been approved.
Set up Git and authentication with GitHub.com from Git
How to Fork a Repo in GitHub
Step 1 – On GitHub.com, navigate to the octocat/Spoon-Knife repository.
Step 2 – In the top-right corner of the page, click Fork.
Step 3 – Select an owner for the forked repository. Here, the owner is vibssingh (as this is my username that is used to login).
Step 4 – By default, forks are named the same as their upstream repositories. You can change the name of the fork to distinguish it further.
Optionally, add a description of your fork.
Here, the new name is GitHub-Demo.
Step 5 – Choose whether to copy only the default branch or all branches to the new fork. For many forking scenarios, such as contributing to open-source projects, you only need to copy the default branch. By default, only the default branch is copied.
Step 6 – Click Create fork button.
This image shows that the GitHub repo is forked and present in your personal GitHub workspace.
We have successfully forked a repository in GitHub. I hope you have enjoyed this tutorial. Happy Learning!!