How to redo changes on top of an updated mainline (part of undoing a faulty git merge)
<p>I am looking over this document on how to undo a faulty merge: <a href="https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html" rel="nofollow">https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html</a></p>

<p>and I am wondering how to redo a feature branch's pull request after it has been mistakenly merged. I don't want to change the history of the mainline branch. To redo the pull request, I think I need to redo changes on top of an updated mainline after a revert commit. Otherwise, my original commits won't show up in the new pull request's diff because they are already part of the mainline's history.</p>

<p>Within that document, here is the section that I am have trouble following:</p>

<blockquote>
  <p>if the developers of the side branch discarded their faulty A and B, and redone the changes on top of the updated mainline after the revert, the history would have looked like this:</p>
</blockquote>

<pre><code>---o---o---o---M---x---x---W---x---x
              /                 \
      ---A---B                   A'--B'--C'
</code></pre>

<p>where my feature branch was merged with <code>B</code> at the head, <code>M</code> is the merge commit, and <code>W</code> is the revert of my feature branche's merge commit. So if I am working on that feature branch, how do I redo my changes to create a branch with <code>A'--B'--C'</code>? Should I cherry pick all of my existing commits?</p>

<p>Basically, I am looking to go from here:</p>

<pre><code>---o---o---o---M---x---x---W---x---x
              /                 
      ---A---B                   
</code></pre>

<p>to here:</p>

<pre><code>---o---o---o---M---x---x---W---x---x
              /                 \
      ---A---B                   A'--B'--C'
</code></pre>

<p><code>git rebase &lt;mainline-branch&gt; &lt;feature-branch&gt;</code> does not create new commits from the existing commits, because those commits are already part of the history (despite the merge having been reverted).</p>