When I write code I break it into small logical changes that are easy and quick to review.
To do so, I use git rebase -i
(interactive) to squash, drop and change order of commits.
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).
For example,
- commit 1
- commit 2
- commit 3
might show up in the PR as:
- commit 3
- commit 1
- commit 2
I've searched the internet and only managed to find this GitHub help page: Why are my commits in the wrong order? Their answer:
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.
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 while performing rebases alters the space-time continuum, which means that commits may not be represented the way you expect them to in the GitHub interface.
If you always want to see commits in order, we recommend not using
git rebase
. However, rest assured that nothing is broken when you see things outside of a chronological order!
Is there a way to work around this?