error: Reverting is not possible because you have unmerged files

末鹿安然 提交于 2020-07-15 12:05:00

问题


When trying to revert a specific commit in git, I'm getting this error:

$ git revert aaaf93201a28a57d540d633b1b723b8e513a47ed
error: Reverting is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: revert failed

Is this about merge conflicts? But why does it say "unmerged files" in that case?


回答1:


It is about merge conflicts, from some merge you attempted before. The unmerged files are the files where the merge conflict happened.

As stated in the error message, you should take care of these files and the contained conflicts before you do anything else. One additional option is to do a hard reset - only attempt this if you know what you're doing.




回答2:


If you want to revert to the previous state of your work do:git merge --abort



来源:https://stackoverflow.com/questions/48151570/error-reverting-is-not-possible-because-you-have-unmerged-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!