Github Desktop – Step 1 – Fork

GitHub Desktop Forking workflow

How to fork a repository

This article is part of a series on Github Desktop. For the introductory piece you can visit here.

You obviously can’t work directly on the main project files, so you first need to take a copy of them to your own GitHub account. This is called a fork and it involves copying the files from the “official” repo (upstream) to your own account (origin).

You will need your own GitHub account before you can begin. Once that is set up and you are logged into your account, find the repo on GitHub that you want to fork. For this example we will be forking Classic Commerce, so we go to the main Classic Commerce repo.

  1. Make sure it still shows you as logged in to your account.
  2. Then click the “Fork” icon in the top right.

GitHub Forking

That’s it! It will now complete the process for you.

IMPORTANT:

GitHub Desktop has a quirky limitation that has been discussed numerous times online but remains unfixed. Creating a fork automatically makes a default branch in your fork with the same name as the default branch in the upstream repo. GitHub Desktop needs these two to have different names.

The solution is to create a new branch with another name in your fork, make it the default and then delete the branch that was created originally. The default branch is often called master, but in our case it is develop. You will need to follow the procedure outlined below.

  1. Click on the Branch button to get the dropdown box of current branches.
  2. Enter the name of a new branch – just use a minor variation of the current default branch.
  3. Click on Create branch.

GitHub Creating a Branch

  1. Now, click on Settings.
  2. Select Branches in the side menu.
  3. Choose the branch name you just made.

Click the Update button to set this as the default branch.

GitHub Updating Default Branch

You will get a warning message – click the button to continue.

GitHub Update Default Branch

On the main screen, click the Branches section in the top menu to see all the current branches.

GitHub branches

  1. Check that you have the new default branch with your unique name.
  2. Then delete the branch that was originally created.

GitHub Fork

Now you are ready to start working in GitHub Desktop.

This article has been provided by Alan Coggins and was originally published on SimplyComputing.com.au. The original post can be found here.

Avatar for Alan Coggins
About Alan Coggins

Alan builds and maintains websites. He thinks that computing is way too complicated for most people and enjoys finding simple and elegant ways to make things happen. His clients seem to appreciate this approach.

Notable Replies

  1. Avatar for james james says:

    I really appreciate you working on this tutorial series and posting it here for our community.

    Using git and GitHub to their full potential gives you tech superpowers, but I’ve found that it’s a difficult task for me to teach this to people who aren’t already familiar with the concepts. The introductory post is indeed a great introduction to how all of this is supposed to work!

    Also, I’m happy to continue answering questions and helping out where I can :slight_smile:

  2. Thanks James. It was partly because it was the best way to clarify it all in my own head. But it’s also good to get a process explained by someone who has only just learned it themselves.

  3. Firstly, just want to say that Alan’s tutorial helps with the overall concepts behind Git as much as it does with how to use GitHub Desktop, so I’d say it’s recommended reading for anyone still new or newish to Git whether you use Desktop or not. It’s an excellent reference point.

    But I also want to add that I now have a much better understanding of Git because of James’ guidance (and patience). When I first started using Git, I used GitHub Desktop, sometimes in conjunction with Atom.

    It was a great help initially but as I got more experienced and started doing more complex operations, I found the command line better to work with. I feel more in control…but I still make the odd boo-boo or two :slight_smile: and still have lots to learn. And I do still use Desktop occasionally when using Windows.

    Anyway, thanks to you both.

Continue the discussion at forums.classicpress.net

Participants

Avatar for ozfiddler Avatar for 1stepforward Avatar for james