Last Updated: February 25, 2016
·
656
· jbowles

remote ref for forked git project

Inside master branch of forked project create remote:

$ git remote add upstream URL-OF-ORIGINAL-PROJECT
$ git fetch upstream

Then do this:

$ git branch -a

And see something like this

* master
   remotes/origin/HEAD -> origin/master
   remotes/origin/master
   remotes/upstream/master

Then merge all commits:

$git merge upstream/master

AN ASIDE:
Inside root of current project open .git/config with text editor:

$vim .git/config

and see the new remote added (should look something like this):

[remote "origin"]
 * fetch = +refs/heads/*:refs/remotes/origin/*
 * url = url-of-your-forked-version
[branch "master"]
 * remote = origin
 * merge = refs/heads/master
 * rebase = true
[remote "upstream"]
 * url = URL-OF-ORIGINAL-PROJECT
 * fetch = +refs/heads/*:refs/remotes/upstream/*