title: How to rebase a branch off a rebased branch?
body: <p>So my history looks like this:</p>
  
  <p><code>
  o---o---o---o  master
       \
        o---o---o  A
                 \
                  o B
  </code></p>
  
  <p>So, to explain:</p>
  
  <ul>
  <li>I have branch <code>A</code> which was started from <code>master</code></li>
  <li>I have branch <code>B</code> (with only 1 commit) which was started from <code>A</code></li>
  </ul>
  
  <p>What I want is this:</p>
  
  <p><code>
  o---o---o---o  master
               \
                o---o---o  A
                         \
                          o B
  </code></p>
  
  <hr>
  
  <p>What I did was:</p>
  
  <p>1).</p>
  
  <p><code>
  git checkout A
  git rebase master
  </code></p>
  
  <p>This resulted in a lot of conflicts which, after some significant time spent fixing, the following history emerged:</p>
  
  <p><code>
  o---o---o---o  master
               \
                o---o---o  A
  </code></p>
  
  <p>Which is exactly what I wanted.</p>
  
  <p>(I don't know where <code>B</code> is right now)</p>
  
  <hr>
  
  <p>2).</p>
  
  <p>After this I did a lot of squashes and changed the order of commits on <code>A</code>, to make the history look like I want.</p>
  
  <hr>
  
  <p>3).</p>
  
  <p>Now, what I also want to do is:</p>
  
  <p><code>
  git checkout B
  git rebase A
  </code></p>
  
  <p>However this doesn't seem to work and I don't know why. If I do <code>git log</code> I see the commits which were there before I did step 1.</p>
  
  <p>Also, I get the same huge number of conflicts which I already solved at step 1. I spent significant time doing it, don't want to do it again.</p>
  
  <p><a href="https://stackoverflow.com/questions/27445747/how-to-rebase-over-already-rebased-branch">This example</a> suggested to use <code>--onto</code>, which I did:</p>
  
  <p><code>
  git checkout B
  git rebase --onto A
  </code></p>
  
  <p>But this deletes the commit on <code>B</code> entirely and makes <code>A</code> and <code>B</code> point to the same commit i.e. the last one on <code>A</code>.</p>
  
  <hr>
  
  <p>My question is: <strong>How can I effectively rebase B off A so that it looks like B started from A</strong> ? (which was actually true in the beginning).</p>
  
  <p>My best guess is that I'm using <code>--onto</code> wrong. Or that I should use something else (like <code>cherry-pick</code>).</p>