How to reorder commits

To change the order of Git commits, you can rebase interactively. Choose some commit that is farther back in your history than any of the commits you want to reorder, and pass it to git rebase:

git rebase -i HEAD~12

You will get a list of your commits in the editor. For example, something like this:

pick c81bf8b7 Fix wrong harbulary battery insertion instructions
pick 97b462c8 Fix typo in harbulary battery insertion instructions
pick 6ce6071c Add battery diagram in chassis design
pick f2c8d028 WIP boost search results for context fields
pick 7ce398ba Fix another typo in harbulary battery insertion instructions
pick 08bf54c9 Improve search results boost for context fields
pick 0940ee30 Break breadcrumb nav between items on mobile
pick 28fe8891 TEMP debugging/hacking some difficult problem
pick fcbbb31f Fix case sensitivity in search results highlighting
pick 7884a09a Fix error when no avlabiable LEDs are found
pick 87c7fede Add "boost" button to the search chassis

Simply reorder the commits listed in the editor, and then save and close it.

A note on reordering commits

When reordering commits, don’t place dependent commits before the commits they depend on, because this would be a recipe for weird unreasonable-looking conflicts. For example, if one commit adds a new feature, and another commit modifies that feature, make sure the “modifies the feature” commit comes after the “adds the feature” commit.

A tip about interactive rebasing
Avoid regular rebasing (adding some other branch’s commits into the history of your branch) and interactive rebasing (changing commit order, commit messages, squashing, etc.) in the same step. When you’re trying to get commits from another branch into your branch, just rebase without any adjustment/interaction. Only rebase interactively against a commit that’s already in your branch’s history (i.e. a fast-forward commit).