简体   繁体   English

Linux和Windows之间的行尾差异的Git问题

[英]Git problems with line endings differences between linux and windows

I'm working on a project on Windows and some project files seems to be changed locally but I didn't. 我正在Windows上的一个项目上工作,有些项目文件似乎在本地更改,但我没有。 Was ignoring them but now I cannot push because are unstaged files. 忽略了它们,但是现在我无法推送,因为它们是未暂存的文件。 When I look into this files differences, there isn't, only this line ending thing (CRLF, LF). 当我查看这些文件的差异时,没有,只有该行结尾的东西(CRLF,LF)。

Tried to revert this files, reset --hard too. 尝试还原此文件,也重置--hard。

Why can't I reset this files to repository HEAD? 为什么不能将此文件重置为存储库HEAD?

Tried to do this too: 也尝试这样做:

git config --global core.autocrlf false

If I do git reset --hard and git status later I get message that have many files with changes not staged. 如果我稍后执行git reset --hard和git status,则会收到消息,其中包含许多文件,未进行更改。

Sorry but I don't know git and this linux/windows line ending differences very well. 抱歉,但我不知道git,并且此linux / windows行的结尾差异非常好。

Maybe someone else working on the project introduced bad line endings. 也许其他从事该项目的人引入了糟糕的行尾。 two things 2 do: 2做两件事:

  1. fix bad line endings already committed. 修复错误的行尾已经提交。
  2. align the team about the line endings policy. 使团队了解行尾政策。

See: Dealing with line endings . 请参阅: 处理行尾

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM