有没有办法让Git标记文件为冲突? [英] Is there a way to make Git mark a file as conflicted?
问题描述
可以提交包含冲突数据的文件。有没有办法将这些文件再次标记为冲突,以便运行git mergetool将生成必要的文件并运行合并工具? 解决方案
您可以使用 git checkout --conflict = merge - file
获得冲突标记文件的内容,但是如果您使用<$ c $清除了索引c> git add file (或者如果GUI为你做)它不起作用。
你可能需要重做合并,或者使用 git update-index --cacheinfo
手动设置阶段版本... git-stash可以帮助您正确保存已解决的冲突。
It's possible to commit files that contains conflict data. Is there a way to mark these files as conflicted again, so that running git mergetool will generate the necessary files and run the merge tool?
You can get contents of file with conflict markers using git checkout --conflict=merge -- file
, but if you have cleaned up index by using git add file
(or if GUI did that for you) it wouldn't work.
There is git update-index --unresolve
, but it is hacky, and does not work very reliably. I think the state it restores would be not enough for git-mergetool.
You would probably have to redo merge, or use git update-index --cacheinfo
to manually set stages version... git-stash can help you preserve correctly resolved conflicts.
这篇关于有没有办法让Git标记文件为冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!