如果用mercurial,只能到b分支中硬还原代码了。
git有智能的方式吗?
人生最曼妙的风景,竟是内心的淡定与从容!
"Want to restore the changed content of a from b", if you want to undo the branch merge operation, please trygit reset/revert {commit}
git reset/revert {commit}
You can use git reflog to check the HEAD pointer changes first, such as:
git reflog
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
git reset HEAD@{2}
You can directly make a new branch for the commit before merging, so nothing will be lost
"Want to restore the changed content of a from b", if you want to undo the branch merge operation, please try
git reset/revert {commit}
You can use
git reflog
to check the HEAD pointer changes first, such as:Then for example
git reset HEAD@{2}
return to a certain submissionYou can directly make a new branch for the commit before merging, so nothing will be lost