I've made a commit, CM
, and then applied several patches, P1
and P2
.
So my history looks like
C1-C2-CM-P1-P2
where C1
and C2
are two previous commits.
The problem is that I forgot to create patch for my commit.
How to move my commit CM
to the top of the commits? The history should look like
C1-C2-P1-P2-CM
If you haven't push your branch yet, you can do an interactive rebase:
git rebase -i C2
You can then reorder your commits as P1-P2-CM
, and re-apply them on top of C2
.
You can use rebase -i
.
$ git rebase -i HEAD~5
It will open your text editor with the latest 5 commits. Reorder the commits in the order you want, then save and close.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With