问题
I would like to merge the following GitHub repositories:
- aosm/objc4
- Apple-FOSS-Mirror/objc4
- bavarious/objc4
- chenniaoc/objc4-551.1
- j4n0/objc4-532
- Jeswang/objc4-532
- macmade/OBJC4-437.1-Runtime
- opensource-apple/objc4
- robertvojta/objc4
In so doing, I would like to make it so this merger ends up looking like robertvojta/objc4 in terms of how its commits, releases, tags, etc., are organized. Is this possible, and, if so, how would I do it? I assume that I won't be able to merge all of the repositories together all at once; so, in which order should I merge the repositories in question; and how would I perform each merger such that I would be able to get the desired results in the end?
P. S.:
OK, so I've started my attempt at merging all of these repositories, but it seems to that macmade/OBJC4-437.1-Runtime, which is the first repository which I think that I will have to merge into RandomDSdevel/objc4, my target repository, because of how this source repository contains files from the earliest version of Objective-C available on GitHub, might be a little tricky to merge. You see, macmade/OBJC4-437.1-Runtime contains what you'd get if you went to Apple's open-source web site, looked under the 'OS X' column for '10.6,' clicked the disclosure triangle to show this parent item's children, clicked on any of the links in the section of the sub-list from '10.6.2' through '10.6.7,' scrolled down to find 'objc4-437.1,' downloaded the source code, went to wherever you saved this download, deleted everything but the 'runtime' folder, extracted its contents into wherever it resided, deleted the (now empty) 'runtime' folder, and made the resulting folder into a GitHub repository.
Anyway, none of the other GitHub repositories containing Objective-C source code have undergone this kind of lobotomy, which means that I'll need to make it so that I can merge the contents of a branch of my (RandomDSdevel's) 'objc4' repository which I made it to track macmade's 'OBJC4-437.1-Runtime' repository into a 'runtime' folder in my (RandomDSdevel's) 'objc4' repository's 'master' branch. So far I've found several different strategies that I could possibly use to merge this 'macmade' branch of my (RandomDSdevel's) 'objc4' repository into the 'master' branch of this repository. Most of them are described in this Stack Overflow question and its answers. That question's first comment also mentions that other solutions may be found in the contents of the discussion surrounding this Stack Overflow question, and one of that question's answers refers the person who originally asked the question to Linus Torvalds's 'coolest merge ever'.
Which of these strategies should I use to merge my (RandomDSdevel's) mirror of macmade's 'OBJC4-437.1-Runtime' repository into my (RandomDSdevel's) 'objc4' repository's 'master' branch such that the former's contents end up in the latter's 'runtime' folder? Could somebody walk me through this, step by step, please? After that, though, I can probably just merge all of the other repositories that I initially mentioned in on top of the merge I want help with from least to greatest version as originally suggested by Mudassir Razvi in his original answer to this question.
回答1:
Anyhow! You can checkout RandomDSdevel/robertvojta_objc4
, add
all the other repositories as remotes
, fetch
from all of them (order does not matter), and merge
whatever you need, wherever you need!
A more sensible way would be to add one repo as remote
, fetch
, merge
, add another
and repeat cycle
so as to avoid confusion!
Update-1
- If you want just the content:
a. Create a Git repository
b. In your new empty repo, Add each of your repositories in folders and commit one at a time. - If you want their histories:
a. Create an empty repo, add all your repositories as Sub-Modules.
b. Then refer this.
来源:https://stackoverflow.com/questions/25922858/how-to-do-a-complicated-git-repository-merger