我想知道是怎么回事。我创建了一个HTML文件并在其中放了一些行
this is first line
this is second line
this is third line
this is fourth line
并在每一行之后提交,如提交a、提交b、提交c、提交d。
现在,我执行了提交c的还原,但是它引发了一个错误:
could not revert 82b69e5... c
hint: after resolving the conflicts, mark the corrected paths <br>
hint: with 'git add <paths>' or 'git rm <paths>' <br>
hint: and commit the result with 'git commit'<br>
我想知道git-还原是如何工作的。我知道类似于“撤消提交并添加新提交”,但不知道如何成功地使用它。
发布于 2019-04-10 00:19:42
它创建了要还原的提交的反向修补程序,因此在您的示例中,提交c
如下所示:
this is first line
this is second line
+this is third line
# End of file
然后,在d
中运行git revert c
,因此它尝试创建以下内容并将其应用于树:
this is first line
this is second line
-this is third line
# End of file
但是,您的文件如下所示:
this is first line
this is second line
this is third line
this is fourth line
# End of file
因此,创建的修补程序不适用(文件结束与第四行冲突)。所以当吉特告诉你:
could not revert 82b69e5... c
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'
意思是“我试着做你要求的,但我面临一个我无法解决的案子”,所以你需要:
git revert --quit
的还原很可能,你的决议是:
this is first line
this is second line
this is fourth line
发布于 2019-04-10 00:35:55
git命令可以被认为是“撤销”类型的命令,但是它不是传统的撤消操作。
本质上,它取消在指定提交中完成的所有操作,然后在流程中创建一个新提交。您可以查看这以获得更多信息。
关于你的问题,你会遇到合并冲突。为了解决这些冲突,您可以使用(Ex )。(美联)
https://stackoverflow.com/questions/55607712
复制相似问题