How to combine the GIT history of an erroneous SVN migration

1

I have a GIT repository migrated from SVN. Because a folder was copied to the SVN, the history has not been migrated correctly. I try to explain graphically:

SVN :  r1    \ --> carpeta raiz --> Projecto1 \ fichero1
                                                fichero2 
  . 
  .  pasa el tiempo... y no vuelve
  .
  . 
SVN :  r1000 \ --> carpeta raiz
               --> Proyecto1 \ fichero1
                               fichero2
                    ^
                    |
                    ------> Despues de un tiempo, esta carpeta se migra a GIT

Due to the change, the full story has not been migrated to GIT (it only appears from r1000 to HEAD) Now we want to add this lost history in the migrated GIT repository, (from r1000 to r1), but this repository is already in use and the intention is that the historical one appears later:

GIT_ACTUAL --> A (1.2018) - B (2.2018) - C (3.2018) - D (HEAD)
VIEJOS_LOGS --> E (1.2016) ... F (1.2017) 

The idea is to keep something like this:

WORKING --> E ... F --> A - B - C 

The files are the same and it would be nice to keep the story, the tests I've done have not managed to mix it correctly. Any suggestions?

UPDATE: More details

I migrated the repositories doing:

URL=http://server.name/project1
git svn clone --authors-file=authors.txt $URL -r1000:HEAD first-migration 

Later I did:

URL=http://server.name/common/
git svn clone --authors-file=authors.txt $URL -r1:1000 second_migration
cd second_migration
git filter-branch 

We now have two repositories, first-migration that is in use and is used for the current development and second_migration, which contains the old revisions (of 1-1000) What I have achieved so far:

mkdir migration
cd migration
git init
git remote add newest ssh://gitserver:first-migration
git remote add older  ssh://gitserver:second-migration
git remote update 
git checkout newest/master -b new.master
git checkout 1abc2def3   -b new.firstcommit 
git checkout older/master -b old.master
git rebase --preserve-merges --root --committer-date-is-author-date new.master
git checkout new.master -b master
git remote add fullhistory ssh://gitserver:final.git
git push fullhistory --all 

In this case, new.firstcommit is the first commit that was made during the first migration. After these operations the story is available but appears "disconnected".

My question is, above all, how to integrate ancient history in the best way. (no problem in creating a new repository)

    
asked by Fernando Rosado 28.06.2018 в 14:28
source

1 answer

0

Thanks to the comment of alo-malbarez I was able to get what I was looking for. The process is concluded by doing the following:

git checkout old.master
git cherry-pick new.firstcommit
# No creo que sea necesario hacer esto, pero prefiero dejar constancia  
git commit --allow-empty -m "Mixing histories"
git rebase -s recursive -Xtheirs --onto old.master new.firstcommit new.master
git push --all --tags

Finally it seems that I am already mixing stories correctly.

    
answered by 13.07.2018 / 09:45
source