Git奇怪的行为 [英] Git strange behaviour

查看:99
本文介绍了Git奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   readme.txt
#       modified:   requirements.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

我没有对这些文件进行任何更改.但是即使尝试,我也会收到此消息:

I didn't make any changes on those files. But I'm getting this message even if I try:

git checkout -- readme.txt
git checkout -- requirements.txt

当我跑步时:

git diff

它显示整个文件已更新.但是内容是一样的.

it shows the whole file as updated. But the contents are the same.

我试图删除它们并再次签出,但是没有用.

I tried to delete them and checkout again, but it didn't work.

推荐答案

如果可以避免任何eol转换,请尝试:

If you can avoid any eol conversion , try:

git config --global core.autocrlf false

(我的首选配置)

,然后再次克隆您的存储库以查看问题是否仍然存在(状态为干净",而不是所有文件已修改").
如果您的编辑器支持其他eol样式并且不进行任何转换,则不会再为您烦恼.

, and clone again your repo to see if the issue persist (clean status instead of "all files modified").
If your editors support other eol style and don't make any conversion, you won't be bothered again.

这篇关于Git奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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