当git revert中止并显示错误消息时,我该怎么办?

icn*_*bot 43 git commit mergetool git-revert

好的,所以当我尝试恢复提交(使用Git)时,我有时会收到错误.我所做的就是

git revert <commit hash>

它给了我这样的信息:

error: could not revert <commit hash> <commit message>
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
Run Code Online (Sandbox Code Playgroud)

这是否意味着我应该使用git mergetool并解决任何冲突?一旦我这样做,我可以添加/ rm然后提交,并恢复完成?

man*_*lds 26

是的,你将不得不解决冲突,将它们标记为有这样git addgit rmgit commit

提交尚未完成,git revert如果你看到.git/MERGE_MSG,你会看到类似的东西:

还原"添加还原"

这将恢复提交c1366607f15a8384434948cb0bcbf8ece48bb460.

冲突:

还原

因此,一旦您解决了合并并执行了操作,git commit您将看到来自MERGE_MSG文件的消息,您可以提交并完成恢复.


ARK*_*han 5

如果要删除所有冲突并删除发生中止错误的还原,则可以使用git reset --hard