tags:

views:

52

answers:

1

I made an error when I was working and wound up with a commit tree I didn't want. Right now, things look like this:

[master]
        A -- B -- C -- D
              \
               \
                C' -- D'
                      [HEAD]

I want to wind up like this:

                        [master, HEAD]
        A -- B -- C -- D

How do I get there from here?

+4  A: 

OK, you're on a detached HEAD, and you want to be on master (currently at A), but with master at D which is a direct descendant.

git checkout master

# This will fast-forward master to D
git merge D

D' and C' will no longer be on any branch so they won't be visible and will eventually be garbage collected.

Charles Bailey