title: How to join two early commits to one commit
body: <p>For a repository like this:</p>
  
  <pre><code>init---A---A2---...---[D---B---merge]---...---master
                          \      /
                           C---B2
  </code></pre>
  
  <p>where <code>B</code> and <code>B2</code> have conflict and was solved in <code>merge commit</code>.</p>
  
  <p>now I want to join commit <code>A</code> and <code>A2</code> to one commit <code>A</code>. And I tried</p>
  
  <pre><code>git rebase -i &lt;commit id of init&gt;
  </code></pre>
  
  <p>and change </p>
  
  <pre><code>pick xxxxxxx A
  pick xxxxxxx A2
  ...
  </code></pre>
  
  <p>to </p>
  
  <pre><code>pick xxxxxxx A
  squash xxxxxxx A2
  ...
  </code></pre>
  
  <p>but conflicts appeared when applying B2, and I have to deal with the conflicts manually just like what I have done in <code>merge</code>.</p>
  
  <p>Actually, there are so many structures like or even more complex than in square brackets in the whole commit tree. So it's not realistic to deal with all the conflicts manually.</p>
  
  <p>The problem is that when I use <code>rebase</code>, the whole commit tree will merged into one line and it will not deal with the conflict automatically by applying the commit <code>merge</code>.</p>
  
  <p><strong>So what can I do to join only the commits A and A2 but still remain all the commit structure after A2 unchanged so that the repository 'looks' the same after the operation?</strong></p>
  
  <p>To make some further explanation, in commit <code>A</code> there's some sensitive information added in a test file and it was removed in commit <code>A2</code>. So I can't publish this project if I can't remove these information permanently. So is there any alternative solution to this situation?</p>