Como combinar dois repositórios Git, um instantâneo do outro com o histórico atual?

Eu preciso fazer o inverso deessa questão.

Então, quase um ano atrás, separamos nosso repositório Git copiando o estado atual de ambas as ramificações para um novo repositório. Para simplificar:

<== 2015 Dec              1 Jan                    2016 Jan ==>
Past history, till SVN    New Repo First Commit    All commits to present

Em breve, usaremos subárvores para transformar cada um dos projetos deste repositório em seu próprio repositório Git, mas não quero fazer isso desde que faltem 5 anos de nosso histórico de consolidação em nosso repositório central. Aqui estão as etapas que eu tentei até agora:

cd ProjectFull/
git reset --hard # Project was in a branch
git checkout master # Go to master before trying to rebase
git remote add ProjectSplit ../ProjectSplit # New repository is in another directory
git fetch ProjectSplit # Fetch new repository
git cherry-pick <initial commit hash> --strategy-option theirs
git pull --rebase -s recursive -X theirs origin master

Minha idéia era escolher a confirmação inicial do novo repositório e, em seguida, refazer essa confirmação, mas isso falha. Os comandos que listei acima não apresentam erros, mas excluem todo o histórico do repositório antigo.

Aqui está um log truncado da minha rebase do Git:

$ git rebase origin dev
First, rewinding head to replay your work on top of it...
Applying: Merge branch 'dev' of <REPO> into dev
Using index info to reconstruct a base tree...
<stdin>:298480: trailing whitespace.

<stdin>:298553: trailing whitespace.

<stdin>:298559: trailing whitespace.

<stdin>:298565: trailing whitespace.

<stdin>:298571: trailing whitespace.

warning: squelched 1751272 whitespace errors
warning: 1751277 lines add whitespace errors.
Falling back to patching base and 3-way merge...

CONFLICT (add/add): Merge conflict in <FILE>
Auto-merging <FILE>
CONFLICT (add/add): Merge conflict in <FILE>
Auto-merging <FILE>
CONFLICT (add/add): Merge conflict in <FILE>
Auto-merging <FILE>
CONFLICT (add/add): Merge conflict in <FILE>
Auto-merging <FILE>
CONFLICT (add/add): Merge conflict in <FILE>
Auto-merging <FILE>
<Same>

Failed to merge in the changes.
Patch failed at 0001 Merge branch 'dev' of <REPO> into dev
The copy of the patch that failed is found in:
   ProjectFull/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

O script nesta resposta falhou no meio dos remendos do antigo repositório.

Esta resposta só funciona para repositórios diferentes.

questionAnswers(1)

yourAnswerToTheQuestion