I created an account at https://github.com/, fork someone's project so I have my own repository, instal github client for windows, and clone my repository to my local drive.

I will work on my local drive. But during the developement of the project, I would like to merge the changes in the official, original, project.

I didn't find how to do this. Before, I use tortoiseSVN client for windows, and there is an option "SVN Update" which can update the project to the latest revision. But I am new to Github and its client, and don't know how to do it.

  • which client are you using? – Sathyajith Bhat Oct 12 '12 at 20:10
  • I download the client here, windows.github.com, I thought it is the official client? – user565739 Oct 12 '12 at 20:16
  • that it is, but it's pretty limited - are you looking to merge changes to the original project or from the original project? – Sathyajith Bhat Oct 12 '12 at 20:18
  • merge changes from the original project to my own repository – user565739 Oct 12 '12 at 20:31

The GitHub for Windows client does not support having multiple remotes[1], which is required in order to sync a forked repo with an upstream repository. You'll have to drop to the command line to perform the update. GitHub has some nice instructions in their documentation which I'll summarize:

Once you have your local repo, add a new "upstream" remote:

git remote add upstream <path to upstream repo>   

Now fetch the upstream repo to get the newest updates (not merged to your local repo yet)

git fetch upstream

Now merge in the upstream changes

git merge upstream/master
  • It should be noted it might be feasible to rebase your commits if you didn't push them yet. – Tamara Wijsman Oct 12 '12 at 20:24
  • well, you beat me to it :-) alternatively, a git pull will do the fetch + merge – Sathyajith Bhat Oct 12 '12 at 20:25
  • so "path to upstream repo" is the original project repository, not my own folked repository? – user565739 Oct 12 '12 at 20:35
  • 1
    @user62046 That is correct, you'll add a remote reference the original repo and merge changes from there, then you can push the changes you make back to your personal fork on Github. – heavyd Oct 12 '12 at 20:36
  • 1
    @user62046, that is more of a fundamental git usage question, so I would recommend checking out the git documentation on branching, but to answer your question just change the "master" in the merge command to which ever branch you want to update, so to update "branch_1" run git merge upstream/branch_1 – heavyd Oct 12 '12 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.