开发者

Entire file conflicting in git after first two lines

Between myself and another programmer who are working on the same project we consistently have a problem with git where we will commit a few changes to a specific f开发者_运维知识库ile, push the changes up, and when the other pulls down the entire file is conflicted. It only happens with one file in our repository.

Also we noticed in github when you view that file it only shows the first two lines. However when you view it as raw it contains the entire file.


Are you on Windows if so perhaps the file has Unix end of line markers which things like notepad see as one line. So you probably do see the whole file but you need to scroll to the right to see the other lines.

You can set git to convert line endings. From github Dealing with line endings

The git config core.autocrlf command is used to change how Git handles line endings. It takes a single argument.

On OS X, you simply pass input to the configuration. For example:

git config --global core.autocrlf input
# Configure Git on OS X to properly handle line endings

On article is from Coding Horror


Is it possible that file somehow has an embedded NUL character? By your description of the formatted file view on Github being truncated, it sounds like that might be possible. I'm not sure what the internal merge in Git does when it encounters a NUL character.

If you have hexdump on OS X that will help, otherwise try od with a suitable set of options.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜