Forking a Repository#

Overview:#

  1. Forking a repository


What’s Forking?#

Forking is essentially making a copy of a Github Repo! Scenarios where forking a repo is indicated include the following:

  1. You wish to collaborate on projects that are hosted on GitHub, but you are not one of that project’s maintainers (i.e., you do not have write permissions on it).

  2. You wish to experiment with changing or adding new features to a project, and do not immediately intend to merge them into the original project’s repo (aka, the base repository).

In a fork, you first create a copy of an existing repository, but store it in your own personal GitHub organization (recall that when you create a GitHub account, the organization name is your GitHub user ID).

Let’s say we intend to make some changes to the Aerosol-Mentors-Processing-Routines Repo repo, that ultimately we’ll submit to the original repository as a Pull request.

Note

Be sure you have logged into GitHub at this time!

Notice at the top right of the screen, there is a Fork button:

Fork

Click on it! You should see your GitHub user id (if you administer any other GitHub organizations, you will see them as well). Click on your user id to complete the fork.

ForkDest

After a few seconds, your browser will be redirected to the forked repo, now residing in your personal GitHub organization!

Notice that the Fork button on the upper right has incremented by one, and there is also is a line relating your fork to the original repo:

ForkPost

You now have a copy (essentially a clone) of the forked repository, which is now owned by you.

You could, at this point, select one of the files in the repository and use GitHub’s built-in editor to make changes to these text-based files. But the typical use case that leverages the collaborative power of GitHub and its command-line cousin, git, involves cloning your forked copy of the repo to your local computer, where you can then perform your edits, and (in the case of software) test them on your system.

What’s Next?#

In the next lesson, you will make changes to your fork of a repository, and submit a pull request with the changes!

References#

  1. What the Fork?(GitHub Community)