122

(This question is the opposite of this one)

How can I go from this

dev            C - D
             /
master A - B 

to this?

dev                D
                 /
master A - B - C 

I know I'm going to kick myself when I see the answer, but for the moment I'm a bit stuck...

Community
  • 1
  • 1
Benjol
  • 63,995
  • 54
  • 186
  • 268

2 Answers2

122

Solution

git checkout master
git merge C

With C being the SHA1 of commit C.

Result

                 D (dev)
                /
master A - B - C (move master HEAD)

It should be a fast-forward merge.

Don Scott
  • 3,179
  • 1
  • 26
  • 40
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
21

Necromancy, I know.

git branch -f master C

Will not touch current working tree at all - you can have your work in progress.

aragaer
  • 17,238
  • 6
  • 47
  • 49