How to fork your own repo in Github

While forking your own repo sounds like it should be fairly obvious, its definitely not.
I searched around a bit and found a bunch of circular references to other posts about how to do it, and none were very clear. So I’m posting this to try to make it as clear as possible how to fork your own repo (and its quite easy actually).

Create a new blank repo

First, create a new blank repo that you want to ultimately be a fork of your existing repo. We will call this new repo “forkedrepo”.

Clone that new repo on your local machine

Next, make a clone of that new blank repo on your machine:

$ git clone

Add an upstream remote to your original repo

While this technically isn’t forking, its basically the same thing. What you want to do is add a remote upstream to this new empty repo that points to your original repo you want to fork:

$ git remote add upstream

Pull down a copy of the original repo to your new repo

The last step is to pull down a complete copy of the original repo:

$ git fetch upstream
$ git merge upstream/master

Or, an easier way:

$ git pull upstream master

Now, you can work on your new repo to your hearts content. If any changes are made to the original repo, simply execute a git pull upstream master and your new repo will receive the updates that were made to the original!

Psst: Don’t forget to upload the fresh copy of your new repo back up to git:

$ git push origin master

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s