I have several (~20) Git repositories that are non-overlapping in their files. I want to combine their master branches in a single (new) repository.
After some reading I came up with the following process.
- Create destination repository (git init) and change into it
git remote add <name> <url>
git fetch <name>
git merge <name>/master --allow-unrelated-histories -m "Imported"
git remote rm <name>
- Repeat with 2-5 until all repositories are merged
The first repositories merged nicely and the history was intact, but then I encounter merge conflicts.
E.g. for different files with the same name in different directories (and there has been no renaming on my side):
CONFLICT (rename/rename): Rename "Splittermond_CharGen_JFX/.project"->"BootloaderPlugin/.project" in branch "HEAD" rename "Splittermond_CharGen_JFX/.project"->"Splittermond_Zhoujiang/.project" in "splimo-common/master"
E.g. from files that I moved in the history of the project (and where version left in the tree is the recent position):
CONFLICT (rename/delete): Splittermond_BuU/src/org/prelle/rpgframework/splittermond/buu/BestienUndUngeheuerPlugin.java deleted in HEAD and renamed to Splittermond_BuU/src/main/java/org/prelle/rpgframework/splittermond/buu/BestienUndUngeheuerPlugin.java in splimo-common/master. Version splimo-common/master of Splittermond_BuU/src/main/java/org/prelle/rpgframework/splittermond/buu/BestienUndUngeheuerPlugin.java left in tree.
I assume that Gits ability to track files may be the problem, but I am fairly new to this and don't know how to work around this.
Any help or hint is appreciated.
[Update] It looks like I have at least two repositories that - although not overlapping anymore - once have been overlapping. I have a git repo A that complains it has deleted files that are now in repo B. And I have a repo B that once contained files that are now in repo A. Is there a way to merge both, keeping the history of all files that not have been deleted?