Not exactly sure of your order of events wrt inserting a commit and editing it (I.e. edit commit message? Or changes?) and modifying it (I.e. see previous) but am happy to try and help if you want to flesh out your example a little more.
Not exactly sure of your order of events wrt inserting a commit and editing it (I.e. edit commit message? Or changes?) and modifying it (I.e. see previous) but am happy to try and help if you want to flesh out your example a little more.
E.g. Commit 1 Commit 2 Commit 3
Using an empty fixup commit, e.g.
git commit --allow-empty --fixup=commit2hash
You would end up with
Commit 1 Commit 2 Commit 3 fixup! Commit 2
Which will adjust automatically (when starting interactive rebase with autosquash) to
Commit 1 Commit 2 fixup! Commit 2 Commit 3
You could then simply change the rebase 'fixup' instruction to 'reword' to edit/remove the 'fixup!' part of the message, or 'edit' to continue the rebase uo until that commit and then stop.
That said, again, not clear on your use case but maybe that might help you or another reader.