简体   繁体   中英

How do I merge between multiple forked repositories on GitHub?

I'm still very new to coding and Github and as such am a little confused with how forking repos works - so please forgive what may be a basic question.

I've been working on a project with different pair partners all week and my current code base situation is as follows:

My initial repo - https://github.com/timrobertson0122/yelp_clone

This code was then forked and work continue on a second repo - (can't post url)

That repo was subsequently forked and contains the most recent code, that I worked on with a colleague yesterday, which I can't fork - https://github.com/curlygirly/yelp_clone-1

So my question is how do I sync my original repo? Can I just add an upstream to the most recently forked repo that points to the original repo? Do I need to submit pull requests?

Thanks.

You can add curlygirly 's repo as a remote to your original repo and merge in changes from it just like any other branch. For example, if you want to merge everything on curlygirly 's master branch into your original repo's master :

git remote add curlygirly https://github.com/curlygirly/yelp_clone-1.git
git fetch curlygirly
git checkout master
git merge curlygirly/master

You can also do this using Pull Requests if you prefer, want to put it through code review, etc. Simply open a request from curlygirly:master (or any other branch) to timrobertson0122:master and go from there.

The great thing about Git is that repositories, branches, commits, etc. are all just building blocks you can manage any way you like. There's nothing special about your first repo, origin , or master , so you're free to work on code anywhere, and move it anywhere else later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM