 <p>You can checkout branch B and do a git rebase.</p> <p><code>git checkout B</code></p> <p><code>git rebase M4</code></p> <p>Where M4 is the SHA of the commit M4.</p> <p>That should move your branch to a new base. Although if branch B has been pushed, and you still do a rebase, be prepared for some work if you are only contributor or some curses if you are a team worker.</p>