title: Restore history of divergent, then convergent repo
body: <p>I am working on restoring the history of a codebase. I have recovered <a href="https://stackoverflow.com/questions/40630304">commits lost at the root</a> of my git repo, and have now discovered a new complication.</p>
  
  <p>A large chunk of code was split into a separate codebase for a while... and then merged back in.</p>
  
  <pre><code> Main repo:  A -- B -- C -- D -- E
                    |         ^
  Code moved:       |         |
                    V         |
  Other repo:       X -- Y -- Z
  </code></pre>
  
  <p>When the split (and merge) occurred, the files were simply copied into the target repo, and the history was lost.</p>
  
  <p>To complicate matters further, the files were slightly modified on each copy before commit, so it's likely that I will need an extra commit for those changes.</p>
  
  <p>This leads me to two questions:</p>
  
  <p>Will it be possible to replace commit <code>D</code> (which copies the files back in) with the lower branch (<code>X-Y-Z</code>)? (This is my priority.)</p>
  
  <p>If that's possible, will it be possible to restore the history of the files created at commit <code>X</code> as well?</p>
  
  <p>There are around 300 commits on the "other" repo, and around 5000 on the "main" repo from <code>D</code> onwards.</p>
  
  <p>I suspect <code>git-rebase</code> is probably required, but ideally, I would like to make use of <code>git-filter-branch</code> so that I do not have to manually resolve historical merge conflicts.</p>