tags:

views:

36

answers:

2

Okay I almost have this rebase thing figured out.

I can feel a breakthrough coming - here is the tipping point:

How do I do a rebase to go from:

A - - B - - C - - D - - E (HEAD)
|
\ - - F - - G (branch1)

To:

A - - B - - C - - D - - E (HEAD)
                  |
                  \ - - F - - G (branch1)

I don't just want to merge HEAD~1 into branch1, I think I want to rebase branch1 right?

I feel like I almost grok this - help!?

+2  A: 

This is a standard rebase, there's nothing tricky going on. You want to:

git checkout branch1
git rebase D
Michael Mrozek
Oh that seems too easy.
willoller
@wil It's trickier if you want to rebase part of a branch, like if you wanted to have G branched off D but leave F branched off A. In this case you're just changing the base of branch1 to be D instead of A
Michael Mrozek
+1  A: 

This can be done with git rebase:

git checkout branch1
git rebase {COMMIT ID of D}
Andreas Rehm