git 将分支指向新的提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3492536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:29:34 来源:igfitidea点击:
Point branch to new commit
提问by Benjol
回答by VonC
Solution
解决方案
git checkout master
git merge C
With C
being the SHA1 of commit C
.
随着C
被提交的SHA1 C
。
Result
结果
D (dev)
/
master A - B - C (move master HEAD)
It should be a fast-forward merge.
它应该是一个快进合并。
回答by aragaer
Necromancy, I know.
通灵术,我知道。
git branch -f master C
Will not touch current working tree at all - you can have your work in progress.
根本不会触及当前的工作树 - 您可以进行工作。