DEV Community

Sarah Bartley Dye
Sarah Bartley Dye

Posted on

Connecting Your Computer with GitHub-Part Two

Now that you are connected to GitHub, the rest of this Skillcrush 105 lesson talks about everything you can do with this new connection you just created. This means you can work with any repository you find on GitHub. You can now add repositories to your new account.

This lesson talks about a few different commands, such as forking, cloning, and modifying repos. These actions are what developers use to add repos. This means that at the end of this lesson, Skillcrush students push their first repo to GitHub.

Today's post is part two and will focus on forking. Skillcrush students learn what forking is and how developers might use it when they are on GitHub. They walk students through the steps for forking their first repo.

What is forking?

Forking might sound a little bit strange. It did to me when I first heard about this command. When you are working in Git, forking is how developers connect computers to GitHub.

A fork on GitHub means that developers are connecting their computers to GitHub. When people make copies of a paper, a copy machine will make a copy of that paper. This is similar to how a fork works on GitHub.

The computer can make a copy of the GitHub user’s repo. Unlike real-life copy machines, computers can take that copy and replicate it to the GitHub account. That replicated repo will remain connected to the original one that the computer made.

Skillcrush explains this better than I can. They tell students to imagine they are helping a friend with their code. Chances are, when you help a friend, you will create a copy for yourself.

This way, you can make changes without impacting the original. That also means avoiding confusion as well as less stress and work in the future. That is why developers fork a repo.

Before you start to fork repos on GitHub, there is one thing you need to remember. You can only fork repos on GitHub. It will not work if you are trying to do this on the command line.

Therefore, double-check that you are on GitHub when you want to fork a repo. You will use the command line later, but always check where you are starting when you are working with Git and Github.

How to fork a repository on GitHub

Step One: Always double-check where you are. Are you on GitHub? If not, go to GitHub and make sure you are logged in.

Once you are logged in, find a repo you want to copy. Use the search bar at the top to find any repository you want.

Step Two: Now that you have a repo you'd like to copy, go to the top right corner of GitHub. Find a button called fork.

Step Three: When you press the fork button, GitHub will ask you if you want to copy all the branches or just your main branch. This will depend on what you want.

  • If you just want the main branch, check the option “Copy the main branch only”.
  • If you want to copy all the branches, remove the check.

Step Four: When you are ready, click the button that says Create Fork. GitHub will create a copy of the repository. That copy can be found on your GitHub account.

Top comments (0)