我应该怎么做,当git恢复与错误消息中止? [英] What should I do when git revert aborts with an error message?

查看:168
本文介绍了我应该怎么做,当git恢复与错误消息中止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我在尝试恢复提交(使用Git)时有时会收到错误。我所做的只是

git还原<提交哈希>



,它给了我这个信息:

 错误:无法恢复<提交哈希> <提交消息> 
提示:在解决冲突之后,将校正后的路径标记为
hint:用'git add<路径>'或'git rm<路径>'

这是否意味着我应该使用 git mergetool 并解决所有冲突?一旦我这样做了,我可以添加/ rm然后提交,并且还原完成?

解决方案

是的,您必须解决使用 git add git rm git commit code>



git revert 之后,提交还没有完成 - 如果您看到.git / MERGE_MSG,您会看到如下所示:


还原添加还原



回复提交
c1366607f15a8384434948cb0bcbf8ece48bb460。



冲突:

还原


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


OK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is

git revert <commit hash>

and it gives me this message:

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>'

Does this mean that I should use git mergetool and resolve any conflicts? Once I do this can I add/rm and then commit, and the revert is complete?

解决方案

Yes you will have to resolve the conflicts, mark them as so with git add or git rm and git commit

The commit is not done yet, after the git revert - if you see .git/MERGE_MSG, you will see something like:

Revert "adding revert"

This reverts commit c1366607f15a8384434948cb0bcbf8ece48bb460.

Conflicts:

revert

So once you resolved the merge and do a git commit you will be presented with the message from the MERGE_MSG file and you can commit and that completes the revert.

这篇关于我应该怎么做,当git恢复与错误消息中止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆