How can I rebase part of a branch to the master branch?
Originally, I had something like this: C---D (branch1) / A---B (master) Because I needed to work on something else (which was unrelated to branch1 ), I decided to make a new branch (called branch2 ). I made a couple of commits on branch2 and then pushed them. Now, my intention was to have master as a root of branch2 . However, I accidentally did this: E---F--G (branch2) / C---D (branch1) / A---B (master) Is there a clean way to make branch2 stem directly from master , as shown below? E---F--G (branch2) | | C---D (branch1) |/ A---B (master) The ASCII graphs in your question have an uncanny