开发者

Git - to fork or not to fork

New to Git and still a little perplexed. I have forked a project on github and would like to bring in/merge some recent changes made by the project owner on the original to my fork. Is this possible? The project is read only but basically, I'd like to get myself to a point where I can ma开发者_JS百科ke edits and add code and then also bring in any changes in from the original/master.

Maybe I don't need to make a fork, and should just clone the master to my local hard drive. Any help much appreciated,


Yes, you can add the original repository as a remote to your local repository

$ git remote add upstream http://.....

and then you can

$ git fetch upstream
$ git merge upstream/any-changes

to get that data into your local branches (which you can then push back to your github fork)


You might also want to consider git rebase. This undoes all your commits, fast forwards you to the latest commit on the upstream repository, then applies your commits one by one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜