Point branch to new commit

(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...


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.


Necromancy, I know.

git branch -f master C

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

链接地址: http://www.djcxy.com/p/630.html

上一篇: 使用git将提交从主服务器移动到分支上

下一篇: 点分支到新的提交