Last updated 2023-02-26 09:57:38

What Does Forking A Repo Mean?

When you have a project whose collaboration is managed using Git [↗] and distribution is done using a service like Github [↗], you will have developers clone [→] the project so they have a local copy of it. When they are done with their changes they will have to push back their modified copy to the original version that is on GitHub.

Diagram showing how forks work [→]

A fork is when you create your version on a distribution service like GitHub. Thus instead of cloning the original project onto your local machine, we can say you "clone onto your own online version". And it's from your own online version that you clone onto your local computer.

This means when you are done making local changes you can push "upstream" [→] onto your own online version instead of the original version.

The reason you might want to have your own version include being able to still take new changes from the original project and merge or in lay terms add to your online version, all the while being able to add your own custom changes to your online version without disrupting the code of the original version.

A real-life example is needing two versions of say software used to tell if a coin is a counterfeit. Say version 1 is used to detect old coins, but on the release of a new coin the software developers decided to fork the original software and layer on top of the new coin feature detection code.

Version 1 remains the original source code [→] and still gets updated since there are some general coins features, these changes can also be pulled in for version 2 of the software, all the while version 2 of the software has unique feature detection code that is not available to version 1 of the software.

How to fork a repository

Below I have linked to articles on the fork process for a couple of source code hosting platforms.

Here is another article you might like 😊 "What Does General Purpose Mean?"