用二进制文件解决Git冲突 [英] Resolving a Git conflict with binary files

查看:98
本文介绍了用二进制文件解决Git冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Windows上使用Git(msysgit)来跟踪我一直在做的一些设计工作的变化。

I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.

今天我一直在研究不同的PC(远程回购 brian ),现在我正试图将今天完成的编辑合并到我的笔记本电脑上的常规本地版本中。

Today I've been working on a different PC (with remote repo brian) and I'm now trying to merge the edits done today back into my regular local version on my laptop.

在我的笔记本电脑上,我使用 git pull brian master 将更改拉入我的本地版本。除主InDesign文档外,一切都很好 - 这表现为冲突。

On my laptop, I've used git pull brian master to pull the changes into my local version. Everything was fine apart from the main InDesign document - this shows as a conflict.

PC上的版本( brian )是我想要保留的最新的一个,但我不知道哪些命令告诉repo使用这个。

The version on the PC (brian) is the latest one that I want to keep but I don't know what commands tells the repo to use this one.

我试图直接将文件复制到笔记本电脑上,但这似乎打破了整个合并过程。

I tried directly copying the file across onto my laptop but this seems to break the whole merge process.

任何人都可以指向正确的方向吗?

Can anyone point me in the right direction?

推荐答案

git checkout 一个 - 我们的 - 他们的选项适用于这种情况。所以如果你有合并冲突,并且你知道你只是想从你正在合并的分支中获得文件,你可以这样做:

git checkout accepts an --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt

该版本的文件。同样,如果你知道你想要你的版本(不是合并的版本),你可以使用

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt

这篇关于用二进制文件解决Git冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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