Difference Between fork and clone in GitHub
In GitHub when we want to work on someone else project we usually do either cloning or forking. In this article, we will learn what is the difference between fork and clone in Github. Forking is a concept while cloning is a process operated over a repository which we are supposed to discuss here.
Note: They are very important or a developer can consider it as a first step towards development in computer programming.
Concept: Fork a repository
Fork is an operation been perform over the projects as real big projects contain chunks of pieces of code consisting of 1000 lines. Here if we try to do changes and if something goes wrong then it becomes very tedious for a programmer or community to correct it. So using this Fork operation we are creating a copy of the repository in which changes are supposed to be made and reflected without affecting the original project.
There is a connection that exists between the fork of a repository and the original repository itself.
The fork acts as a bridge between the original repository and the personal copy of the repository where we can make changes. After making the changes we can contribute back to the original repository using Pull Requests. Now let us discuss a very simple procedure to fork a repository from below listed simple 2 steps which are as predicted with help of visual aid below.
- Open any repository on Github
- Just click the Fork button in the header of a repository.
Note: It will take some time and when the process is complete, the forked copy of the project will open. Now let us see what Clone stands for in developing projects or be it a smaller program.
Process: Clone a Repository
When we create a new repository on GitHub or Any repository on Github, it exists as a remote location where our / any other repository is stored. Cloning a repository creates a local copy on our computer so that we can sync between both the local and remote locations of the repository.
we can not contribute to the repository unless we are made the collaborator of the repository. Cloning is an ideal case when one wants to get his own copy of a repository where he may not be contributing to the original project.
How to clone a repository?
- Open any repository on Github
- Click on the code button to get the repository’s HTTPS or SSH URL.
- We are ready to perform the clone using the git clone command in the command-line interface as depicted in below visual aid.
Now let us discuss the conclusive differences between Fork and Clone operation over a repository, been depicted below in a tabular format provided below as follows:
|Forking is done on the GitHub Account||Cloning is done using Git|
|Forking a repository creates a copy of the original repository on our GitHub account||Cloning a repository creates a copy of the original repository on our local machine|
|Changes made to the forked repository can be merged with the original repository via a pull request||Changes made to the cloned repository cannot be merged with the original repository unless you are the collaborator or the owner of the repository|
|Forking is a concept||Cloning is a process|
|Forking is just containing a separate copy of the repository and there is no command involved||Cloning is done through the command ‘git clone‘ and it is a process of receiving all the code files to the local machine|