git 在单个文件中重新启动/撤消冲突解决

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14409420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:18:17  来源:igfitidea点击:

Restart/undo conflict resolution in a single file

gitgit-merge

提问by Alex Krauss

In a larger git merge with several conflicting files, I incorrectly marked a file as resolved (using git add FILEafter some editing)

在包含多个冲突文件的较大 git merge 中,我错误地将文件标记为已解决(git add FILE经过一些编辑后使用)

Now I'd like to undo my conflict resolution attempt and start over resolving that file.

现在我想撤消我的冲突解决尝试并重新开始解决该文件。

How can I do that?

我怎样才能做到这一点?

回答by Alex Krauss

Found the solution here: http://gitster.livejournal.com/43665.html

在这里找到解决方案:http: //gitster.livejournal.com/43665.html

git checkout -m FILE

This restores the unresolved state, including all information about parent and merge base, which allows restarting the resolution.

这将恢复未解析状态,包括有关父级和合并基的所有信息,从而允许重新启动解析。

回答by Steven Penny

git reset HEAD FILE

Example

例子

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)