有没有办法让Git标记文件为冲突? [英] Is there a way to make Git mark a file as conflicted?

查看:284
本文介绍了有没有办法让Git标记文件为冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以提交包含冲突数据的文件。有没有办法将这些文件再次标记为冲突,以便运行git mergetool将生成必要的文件并运行合并工具? 解决方案

您可以使用 git checkout --conflict = merge - file 获得冲突标记文件的内容,但是如果您使用<$ c $清除了索引c> git add file (或者如果GUI为你做)它不起作用。



git update-index --unresolve ,但这很不好,并且不能很可靠地工作。我认为它恢复的状态对于git-mergetool是不够的。



你可能需要重做合并,或者使用 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屋!

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