简体   繁体   中英

Git upstream branch on remote repo on Github

There are 3 remotes, Primary, Secondary and Tertiary.

Secondary is a fork of Primary with more additions. Tertiary is a fork of Secondary with even more additions.

Secondary is kept in synch with Primary by adding an upstream to a local copy of Secondary and then fetching+merging from Primary and pushing back to remote Secondary. No problem here.

Now, I need a local copy of Tertiary (or any other local copy of forked Secondary) to be aware about Secondary's upstream to be able to fetch+merge from Primary without adding Primary manually.

Also, I need to know how can I 'chain' these upstreams, that every next fork (in depth) would know about all parent upstreams and would be able to synch with all or any of them.

So the main question is: "How to save upstream to remote repo so anyone who will fork it later will be aware about upstream?".

You shouldn't be able to propagate upstream information when cloning a repo, because they are store in the .git/config (local config of a repo).
And as I detail in " Is it possible to clone git config from remote location? ", you cannot clone a git configuration.

That stream suggests to memorize the necessary modification to make to your local config (once you have cloned a repo) in a script.
Which is similar to the manual process described in " Propagate a remote location via clone/push/pull ".

But those solutions all require an extra step to be applied once the repo is clone on your local workstation.

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