While working on an open source project I encountered the following issue with git. I made a few changes, and sent a pull-request. The PR was accepted at first. However, my changes turned out to have some subtle bugs and the maintainer reverted my commits again, asking me to send a new pull-request once I've fixed the issue. However, a lot of other commits have happened in between, so I need to update my pull-request. Unfortunately, I cannot get git to rebase or cherry-pick my old PR on top of the most recent state of master
.
Let me clarify things with an example. Say, my original pull-request had commits A
, and B
and was accepted. Then, a few commits later my PR was reverted (R
), and then a few more commits happened. The history looks like this:
...--A---B--...--R--...--o master
Now, I want to transform it to the following form, in order to refine my pull-request on top of the most recent state of master
:
...--A---B--...--R--...--o master
\
A---B newPR
However, I failed to achieve this with both rebase
, and cherry-pick
. The problem seems to be, that git thinks that A
, and B
are already part of master
, as they are already in the history. So, it doesn't apply these changes on top of master
.
How can I force git to do this?