So, when reinstalling, select for fixing both the commit, where you added the file by mistake, and the one you want to add to this order. If the file is in the last commit, but must be in an earlier commit, you will have to reorder the lines. For example, I start with
pick 8de731b Commit with missing file. pick bbef925 Commit with too many files. pick 52490ce More history.
I need to change it to
edit bbef925 Commit with too many files. edit 8de731b Commit with missing file. pick 52490ce More history.
Then
Unfortunately, when editing history in one branch, I donβt know how to avoid editing history in all branches. Reinstallation should be done as early as possible to avoid such problems. In my simple case, I can combine the master and the other branch, but the commits do not merge, then I need to reinstall the wizards and reorder and crush the commits, for example:
pick 7cd915f Commit with missing file. fixup 8de731b Commit with missing file.
Later editing: I just noticed that I accidentally reordered the commit history as a carryover from my original answer. Rearranging the lines in rebase changes the order you do; after editing, you can reinstall and change them again to return to the original fixing order.
source share