只重新合并一个文件 [英] Redo merge of just a single file
问题描述
我处在一个大合并的中间,我用 git mergetool
来解决所有的冲突,但是我还没有提交,因为我想要以确保合并是第一次。
事实证明,我在解决一个文件中的冲突时犯了一个错误,我想重新解决冲突该文件上的 git mergetool
。由于这是一个很大的合并,我想避免重做所有其他文件的合并,因为我知道我必须处理 git merge --abort
。 p>
我知道我可以手动编辑这个文件,但是这样会很繁琐,只需重做 git mergetool
操作。这是可能的吗?
看来我只是看错了地方。解决方案结果非常简单。
git checkout -m< file>
这会将文件返回到冲突状态。然后我可以运行 git mergetool
来重新进行合并。
I'm in the middle of a large merge, and I've used git mergetool
to resolve all the conflicts, but I have not committed yet, as I wanted to make sure the merge was ok first.
It turns out that I made a mistake while resolving the conflicts in one file, and I would like to redo the conflict resolution with git mergetool
on that file. As this is a large merge I would like to avoid redoing the merge on all the other files, as I understand I would have to do with git merge --abort
.
I know I could just edit the file manually, but this would be quite tedious and it would be much easier to just redo the git mergetool
operation. Is this possible?
It seems I was just looking in the wrong place. The solution turned out to be quite simple.
git checkout -m <file>
This returns the file to its conflicted state. I can then run git mergetool
to redo the merge.
这篇关于只重新合并一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!