How to fix commit order in GitHub pull requests, broken by git rebase? : <p>When I write code I break it into small logical changes that are easy and quick to review.</p>

<p>To do so, I use <code>git rebase -i</code> (interactive) to squash, drop and change order of commits.</p>

<p>I've noticed this sometimes leads to a different order of commits on a GitHub pull request (though the order is retained on the remote branch). </p>

<p>For example,</p>

<ul>
<li>commit 1</li>
<li>commit 2</li>
<li>commit 3</li>
</ul>

<p>might show up in the PR as:</p>

<ul>
<li>commit 3</li>
<li>commit 1</li>
<li>commit 2</li>
</ul>

<p>I've searched the internet and only managed to find this GitHub help page: <a href="https://help.github.com/articles/why-are-my-commits-in-the-wrong-order/" rel="noreferrer">Why are my commits in the wrong order?</a> Their answer:</p>

<blockquote>
  <p>If you rewrite your commit history via git rebase or a force push, you
  may notice that your commit sequence is out of order when opening a
  pull request.</p>
  
  <p>GitHub emphasizes Pull Requests as a space for discussion. All aspects
  of it--comments, references, and commits--are represented in a
  chronological order. Rewriting your Git commit history <a href="https://help.github.com/articles/about-git-rebase" rel="noreferrer">while
  performing rebases</a> alters the space-time continuum, which means
  that commits may not be represented the way you expect them to in the
  GitHub interface.</p>
  
  <p>If you always want to see commits in order, we recommend not using
  <code>git rebase</code>. However, rest assured that nothing is broken when you
  see things outside of a chronological order!</p>
</blockquote>

<p>Is there a way to work around this?</p>
