GitHub for The Modern Data Scientist: 7 Concepts You Can’t .gitignore | by Bex T. | May, 2023

2. Clone it or fork it?

When someone looks at a remote repository, there are four things that may happen. The likeliest course of action (case 0) is they ignore it or give it a star if they are feeling generous.

In the first case, if the README was convincing enough, they might clone it.

Image by me

Cloning a remote repository with commands like git clone creates an exact copy of awesome_repo on your local machine, giving you access to the project’s entire Git history as well as write access to all the files. However, if you make changes to this local copy of awesome_repo, its remote copy won’t feel a thing.

In the second case, if the README was even more convincing, a person might fork it.

Image by me

When you fork awesome_person‘s awesome_repo on GitHub, you will have the exact copy of awesome_repo under your account.

Your GitHub page will have a new your_username/awesome_repo repository with the same content and history as awesome_person/awesome_repo. If you want to make changes to this copy, you can clone your_username/awesome_repo so that it is also on your local machine.

There are a number of reasons why someone might fork another’s repo. The number one reason is to contribute to someone/awesome_repo by submitting pull requests (see below). Another reason is to create a new project based on the original code, without affecting it.

A notable example of this is the Manim GitHub community, which is a more maintained and documented fork of the legendary Manim repository by Grant Sanderson (creator of 3Blue1Brown and all its videos).

To differentiate between originals and forks, GitHub adds a “forked from original_repo” label on repository pages.

The third case is when you access one of your own remote repositories from a different machine. For instance, you left your laptop in a dry cleaner’s, and you want to continue working on the project in the office.

In this case, all you have to do is clone the repo to download its contents to the office Mac. But, the Git installation on the Mac must be under your GitHub username if you want to sync your changes.

Source link

Leave a Comment