hg - [git]如果把分支a合并到分支b中,想从b中还原a改过的内容,怎么办?
黄舟
黄舟 2017-04-22 09:00:08
0
2
744

如果用mercurial,只能到b分支中硬还原代码了。

git有智能的方式吗?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
黄舟

"Want to restore the changed content of a from b", if you want to undo the branch merge operation, please trygit reset/revert {commit}

You can use git reflog to check the HEAD pointer changes first, such as:

de51e3d HEAD@{0}: merge nnn: Fast-forward
4430e82 HEAD@{1}: checkout: moving from nnn to master
de51e3d HEAD@{2}: commit: commit2
4430e82 HEAD@{3}: checkout: moving from master to nnn
4430e82 HEAD@{4}: commit (initial): test

Then for example git reset HEAD@{2} return to a certain submission

伊谢尔伦

You can directly make a new branch for the commit before merging, so nothing will be lost

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template