git认为文件已经改变 [英] git thinks files have changed

查看:116
本文介绍了git认为文件已经改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台机器上为一个项目做了一些工作,然后推送给github,并在另一台机器上克隆并做了一些工作,然后推送。然后我回到第一台机器上,做了一个 pull 。现在第一台机器认为项目中最初的所有文件都已更改。我试过了

  git checkout -f  -  

  git rm --cached -r。 
git checkout -f

甚至试过了

  git存储

但无论我做, git status 告诉我这些文件已被更改。如何让它停止?

解决方案

这似乎是一个行结束/ autocrlf问题。我认识到一个很好的方法来解决这个问题(如果你的索引不重要):

pre $ git add -u。
$ git reset。


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. Then I went back to the first machine and did a 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. How do I make it stop?

解决方案

This seems to be a line-ending/autocrlf issue. A great trick I realized for fixing this (if your index doesn't matter) is:

$ git add -u .
$ git reset .

这篇关于git认为文件已经改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆