简体   繁体   English

git认为文件已更改

[英]git thinks files have changed

I did some work on a project on one machine, then pushed to github and, on another machine, cloned and did some work, then pushed. 我在一台机器上的一个项目上做了一些工作,然后推送到github,然后在另一台机器上克隆并做了一些工作,然后推送了。 Then I went back to the first machine and did a pull . 然后我回到第一台机器上pull Now the first machine thinks all the files that were in the project originally were changed. 现在,第一台机器认为项目中原来的所有文件都已更改。 I've tried 我试过了

git checkout -f --

and

git rm --cached -r .
git checkout -f

and even tried 甚至尝试过

git stash

but no matter what I do, git status tells me those files have been changed. 但是无论我做什么, git status告诉我那些文件已更改。 How do I make it stop? 我如何使其停止?

This seems to be a line-ending/autocrlf issue. 这似乎是一个行尾/ autocrlf问题。 A great trick I realized for fixing this (if your index doesn't matter) is: 我意识到解决此问题的一个绝妙技巧(如果您的索引无关紧要)是:

$ git add -u .
$ git reset .

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

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