How to Fork a GitHub Repository?
Last Updated : 28 May, 2024
GitHub is a great application that helps you manage your Git repositories. Forking a GitHub repository is a common practice that allows you to create your own copy of a repository hosted on GitHub. In this article, we will learn more about Git-Fork and its uses.
What is GitHub Repository Forking?
A fork is a new repository that shares code and visibility settings with the original “upstream” repository. Forks are often used to iterate on ideas or changes before they are proposed back to the upstream repository, such as in open source projects or when a user does not have write access to the upstream repository.
How to Fork a Repo in GitHub
Step 1: Open the repository that you want to Fork there You can see the icon as shown in the image below in the repo’s top right corner. Now, this feature is used to Fork the repo.
Fork a GitHub RepositorStep 2: Go to any repository that you want to Fork here we are using a sample repo of Python official repository.
Fork a GitHub RepositorStep 3: Find the Fork button in the top right corner.
Fork a GitHub RepositorStep 4: Click on Fork.
Step 5: Now you have your own copy of the repository. But how can we confirm for which do refer to below visual aid as follows:
Fork a GitHub RepositorNow we can see your user name(**********)/mern-todo-app and also below that, we have the link to the original project I forked from.
Whatever changes are made to ‘******/mern-todo-app We can make my changes here and then make a Pull Request to the maintainers of the project. Now it is in their hand if they will accept or reject your changes to the main project.
Fork Using Command Line
Step 1: Open the terminal or gitbash and type the below command.
git --version
Fork a GitHub RepositorStep 2: You must first log in using the CLI to GitHub using your GitHub account before you may fork the repositories. To do it, issue the following command.
git auth login --web > SSH
Step 3: Once authentication is done. Copy the Repo URL that you to fork into our repo and use the below command.
Fork a GitHub Repositorgh clone <REPO URL>
Fork a GitHub RepositorConclusion
Forking a GitHub repository enables users to create their own copy of a project. It's useful for contributing to open-source projects or experimenting with code changes. This process encourages collaboration and allows developers to maintain separate development branches while contributing back to the original repository through pull requests. Overall, forking provides community engagement and the sharing of code among developers.
Explore
Git Tutorial
6 min read
Git Introduction
Git Installation and Setup
All Git Commands
Most Used Git Commands
Git Branch
Git Merge
Git Tools and Integration
Git Remote Repositories
Collaborating with Git
My Profile