首页 > 解决方案 > git shows mysterious changes

问题描述

I'm facing this issue constantly when working in a team. Every time I push changes, there are some changes that weren't made by me, and I can't seem to understand what has changed. I attached an example screenshot from Fork.

You can see there are tiny character highlighted at the end of line 64. The file has LF line ending format, and I don't think it is mixing it with CRLF.

The team uses different OS and IDE's

enter image description here

Note: the highlighted character is not a space. I can't post the text here as it get reformatted by SO.

标签: gitdiffcommitline-endings

解决方案


我可以是行尾空格或换行符。例如,也许他们在括号之后添加了(意外)空格,并且他们的编辑器不会自动修剪它们,而您的编辑器可能被配置为修剪它们,使它们消失,创建更改。

您应该真正与您的团队同步以使用相同的编辑器设置(换行符的类型、修剪行尾等)以避免出现此类情况。


推荐阅读