git显示修改文件但我没有改变任何git reset不起作用

Iva*_*van 7 git line-endings git-status

我克隆存储库切换到我的分支,当我打印git状态我看到修改文件,我尝试做git reset - 硬但是没有效果:((

git status
On branch release

Changes not staged for commit:

    modified:   htdocs/fonts/OfficinaSansBoldC.eot
    modified:   htdocs/fonts/OfficinaSansBoldC.svg
    modified:   htdocs/fonts/OfficinaSansBoldC.ttf
    modified:   htdocs/fonts/OfficinaSansBoldC.woff
    modified:   htdocs/fonts/OfficinaSansC-Book.eot
    modified:   htdocs/fonts/OfficinaSansC-Book.svg
    modified:   htdocs/fonts/OfficinaSansC-Book.ttf
    modified:   htdocs/fonts/OfficinaSansC-Book.woff

no changes added to commit 

git reset --hard origin/release

git status
On branch release

Changes not staged for commit

    modified:   htdocs/fonts/officinasansboldc.eot
    modified:   htdocs/fonts/officinasansboldc.svg
    modified:   htdocs/fonts/officinasansboldc.ttf
    modified:   htdocs/fonts/officinasansboldc.woff
    modified:   htdocs/fonts/officinasansc-book.eot
    modified:   htdocs/fonts/officinasansc-book.svg
    modified:   htdocs/fonts/officinasansc-book.ttf
    modified:   htdocs/fonts/officinasansc-book.woff

no changes added to commit 
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 6

输入core.autocrlf的问题在于,即使对于不应该触摸的(二进制)文档,它也可以更改eol(行尾)字符。

尝试:

git config --global core.autocrlf false
git clone /url/your/repo
Run Code Online (Sandbox Code Playgroud)

(意味着再次克隆您的存储库,并查看这些差异是否仍然存在)


使用git 2.8(2016年3月),您将能够快速检查这些更改是否与eol相关。

提交a7630bd(2016年1月16日)由托斯滕Bögershausen( )tboegi
(由Junio C gitsterHamano合并--commit 05f1539中,2016年2月3日)

ls-files:添加EOL诊断

在跨平台环境中工作时,用户可能需要检查文本文件是否在存储库中进行了规范化存储以及是否.gitattributes设置正确。

使Git可以在索引和工作树中显示行尾以及有效的text / eol属性。

行尾(“ eolinfo”)如下所示:

"-text"        binary (or with bare CR) file
"none"         text file without any EOL
"lf"           text file with LF
"crlf"         text file with CRLF
"mixed"        text file with mixed line endings.
Run Code Online (Sandbox Code Playgroud)

有效的text / eol属性是以下之一:

"", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf"
Run Code Online (Sandbox Code Playgroud)

git ls-files --eol 给出这样的输出:

i/none   w/none   attr/text=auto      t/t5100/empty
i/-text  w/-text  attr/-text          t/test-binary-2.png
i/lf     w/lf     attr/text eol=lf    t/t5100/rfc2047-info-0007
i/lf     w/crlf   attr/text eol=crlf  doit.bat
i/mixed  w/mixed  attr/               locale/XX.po
Run Code Online (Sandbox Code Playgroud)

以显示所显示的每个路径在索引(' i')和工作树(' w')中的数据中使用什么eol约定以及有效的属性

  • 这帮助了我,我不必再克隆仓库 (2认同)