当将master合并到分支中时,Git将整个文件标记为冲突 [英] Git marks entire file as conflicted when merging master into branch

查看:107
本文介绍了当将master合并到分支中时,Git将整个文件标记为冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
使用git最好的CRLF处理策略是什么?

我目前正在一个项目中,几乎每次将master合并到分支中时,我都会遇到合并冲突,其中git表示整个文件已更改.通常,当我使用Notepad ++的比较工具比较这些文件时,它报告实际上只有几行发生了更改,而且通常甚至不会导致冲突.

I'm currently working on a project where almost every time I merge master into my branch, I get merge conflicts where git says the entire file has changed. Often when I compare these files using Notepad++'s compare tool, it reports that only a couple of lines have actually changed and often it shouldn't even result in a conflict.

一段时间以来,我只是忍受这种行为,因为在跨平台工作时必须解决此问题(我们的团队使用Windows 7,OSX和Debian进行混合开发),但是今天我合并了有些严重的问题阻止了我前进.我自己检查了一下,看来它可能与git core.autocrlf配置有关,但是我不确定如何解决此问题,以便它立即消失,或者随着git修复损坏而慢慢消失我以前做过.任何人都可以提出有关如何解决此问题的建议吗?

For a while I've simply put up with this behaviour as a problem that has to be suffered whilst working cross-platform (our team uses a mixture of windows 7, OSX and debian for development), but today when I merged there were some serious issues which are stopping me from moving forward. I've looked into this myself and it seems that it might be related to the git core.autocrlf config, but I'm unsure how to solve this issue so that either it goes away immediately, or will slowly disappear as git fixes the damage I've previously done. Could anyone give any suggestions as to how to fix this?

谢谢,
亚历克斯

Thanks,
Alex

推荐答案

我终于解决了这个问题-我必须启用autocrlf.我已经阅读了很多关于此标志的建议,但在这种情况下它似乎可以工作.

I've finally resolved this problem - I had to enable autocrlf. I've read a lot of recommendations against this flag, but it appeared to work in this case.

git config --global core.autocrlf true

这篇关于当将master合并到分支中时,Git将整个文件标记为冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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