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

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

问题描述

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

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?

推荐答案

你可以使用 git checkout --conflict=merge --file 获取带有冲突标记的文件内容,但如果你已经清理过使用 git add file (或者如果 GUI 为你做了)它不会工作.

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.

git update-index --unresolve,但它很笨拙,并且不能非常可靠地工作.我认为它恢复的状态对于 git-mergetool 来说是不够的.

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.

您可能需要重做合并,或者使用 git update-index --cacheinfo 手动设置阶段版本...git-stash 可以帮助您保留正确解决的冲突.

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天全站免登陆