Git: merging two mismatched independent repositories

Repository A: ported to git from the SVN project in version r: cloned it all, including the entire SVN history, tags, etc. After that, git developed a bit.

Repository B: The same project, but independently migrated from SVN during revision r+small_number. Only the last snapshot was provided in git. After that there will be a lot of independent development.

Now I have combined A into B. The idea is that SVN will be dropped, development will continue to work in developthe repo project branch on GitHub. I used simple merging to do the job; fortunately, there were very few real conflicts . The development was mainly in different areas, although after the merger a lot of cleanup was done, not related to git.

But: now that I do it. git rebase -i HEAD~2in the combined result , which, as I understand it, should allow me to reinstall the last two commits, I am greeted by a page with more than 300 + commits - a complete history of the project from version 1 on SVN . I aborted the permutation for fear of spoiling even more (obviously I'm a complete git newbie).

Is such a result expected? Is desirable? If not, how to fix it?

Please note that all unit tests, etc. pass, the files themselves are fine, but I don’t understand what happened to the git metadata / history.

EDIT: this is what I * think * . The repository is as follows:

          r         A
... o --- o --- ... o 
                     \ 
               B      \    
    o --- .... o ----  o --- ... o 
   r+small_number      C         HEAD
+3
source share
1 answer

I assume this is happening because you are trying to reset a merge transaction.

In the following answer, I assume your story looks like this: repositories A and B are completely independent:

          r         A
... o --- o --- ... o

o ... o
r'    B

, ? , C, A, B. ? ; , r' SVN? git A B ?

, . A B SVN, git . , :

          r          A
... o --- o --- .... o
           \
            \
             o --- .... o
       r+small_number   B

, , git rebase -p --onto r --root B.

git merge A B

          r          A     C
... o --- o --- .... o --- o
           \              /
            \            /
             o --- .... o
       r+small_number   B

C . , ; .

+8

All Articles