about git-merge "Binary files differ"

本文详细介绍了使用Git解决合并冲突时遇到的二进制文件问题,并提供了解决方案。通过对比代码差异,展示了如何手动解决合并冲突,并强调了二进制文件在合并时的不同处理方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

=>run "git merge master"

than:

warning: Cannot merge binary files: 1 (HEAD vs. master)
Auto-merging 1.c
CONFLICT (content): Merge conflict in 1.c
Auto-merging 1
CONFLICT (content): Merge conflict in 1
Automatic merge failed; fix conflicts and then commit the result.

=>run "git diff"

than:

diff --cc 1
index 6d0cda6,d34cdef..0000000
Binary files differ
diff --cc 1.c
index 18b4f17,7a293d3..0000000
--- a/1.c
+++ b/1.c
@@@ -2,8 -2,7 +2,12 @@@
  #include<stdlib.h>
  int main(int argc, char** argv)
  {
++<<<<<<< HEAD
 +      printf("tom:\n");
 +      printf("jane:\n");
++=======
+       printf("Alice:\n");
++>>>>>>> master
        if(argc < 2)
        {
                printf("pls input more than 2 args\n");

=>run "./1 3"

than:

tom:
jane:
hello world
hello world
hello world

====================================

so:

binary file will not insert the differents as text file,

if you want to change it, you should copy another 

one and replace. run "git add filename" &

 "git commit".








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值