我转换了行结尾,git-diff 说我的整个文件是不同的。我做了什么?
这是正常的吗?我应该这样做吗?
我知道 Git 有设置在存储之前将行尾转换为 \n
,但重新配置我的编辑器以默认使用 *nix 样式(不知道它如何更改为 Windows 样式),所以我转换了工作目录中的所有内容,只是为了“赶上”。
有理由害怕吗?
这并不重要,但这些文件是 CSS、HTML、PHP、JS 等。
Is this normal, and should I commit this?
I am aware that Git has settings to conver line-endings to \n
before storing them, but reconfigured my editor to use *nix style by default (don't know how it changed to Windows style), and so I converted everything I had in my working directory, just to "get caught up".
Is there any reason to fear?
Not that it matters, but the files are CSS, HTML, PHP, JS, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
吉特是对的。 Git 的差异基于行是否已更改,并且实际上文件中的每一行都已更改。这就是转换行结尾时发生的情况。
您没有理由担心这一点,但您可能会考虑您提到的第一个选项 - 告诉 git 在提交文件时转换文件,同时将副本单独保留在工作目录中。
Git is right. Git's diff's are based on whether a line has changed or not, and literally every single line in your file has changed. That's what happens when you convert line endings.
There's no reason for you to be worried about this, but you might consider the first option you mentioned - telling git to convert the files as they're committed, while leaving the copy in your working directory alone.