Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep sync with another git repository?

Tags:

git

github

I forked a repository on Github. Now, the original had some update. How can I pull the changes from the original repository and keep sync with them?

And if my source is conflict with the original source, do I have a chance to edit it manually?

EDIT1: Thanks everyone's help. I think I need to RTFM :)

like image 708
比尔盖子 Avatar asked Jul 25 '12 08:07

比尔盖子


2 Answers

What's not stated explicitly in the other two answers is that you can't merge directly from the original project on github to your fork on github, you need to go via a local clone on your own machine.

So you set up the original project as a remote (called upstream in Magnus Skog and CJlano's answers), then pull from that remote into your local clone, resolving any merge conflicts with your local changes, then push the result to your fork on github.

like image 174
Jonathan Wakely Avatar answered Oct 22 '22 20:10

Jonathan Wakely


Just add the original repository as a remote and pull changes from it

git remote add upstream path/to/upstream/repo.git
git pull upstream master
like image 36
ralphtheninja Avatar answered Oct 22 '22 20:10

ralphtheninja