title: How to merge two branches without a common ancestor?
body: <p>I have started using Git in the middle of my project, where the first two commits are just some initial settings (.gitignore and .gitattributes), and the third commit <strong>M2</strong> adds the content of the SVN trunk:</p>
  
  <pre><code>I1 -- I2 -- M2 -- N -- .. -- Z
  </code></pre>
  
  <p>I have imported the SVN history in a branch named <strong>svn</strong>, where <strong>M1</strong> is the SVN trunk (with the same content as <strong>M2</strong>, except .gitignore and .gitattributes):</p>
  
  <pre><code>A -- B -- ... -- K -- L -- M1
  </code></pre>
  
  <p><strong>Q:</strong> What is the best approach in merging both branches?</p>
  
  <p>I could merge <strong>M1</strong> and <strong>M2</strong> into <strong>M3</strong>, and then rebase, but I don't know how to delete the <strong>I1</strong> and <strong>I2</strong> commits and if I can safely remove the <strong>M3</strong> commit (I have found some advices to preserve the merge commits, but in this case <strong>M3</strong> it's not necessary anymore).</p>
  
  <pre><code>A -- B -- ... -- K -- L -- M1
                               \
                                M3 -- N' -- .. -- Z'
                               /
                 I1 -- I2 -- M2 -- N -- .. -- Z
  </code></pre>
  
  <p>Another way would be to cherry-pick the <strong>N</strong> .. <strong>Z</strong> commits into <strong>svn</strong> branch by hand, but I would like to avoid this approach.</p>
  
  <p>The most elegant solution would be to rebase the changes introduced by <strong>N</strong> .. <strong>Z</strong> commits on top of <strong>svn</strong> branch, but I didn't found yet the required syntax for two branches without a common ancestor.</p>