git show修改文件,但我不更改任何内容git reset不起作用 [英] git show modify files but i don't change anything git reset did not work

查看:385
本文介绍了git show修改文件,但我不更改任何内容git reset不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将克隆存储库切换到我的分支,并且当我打印git status时看到修改文件,我尝试执行git reset --hard,但是没有效果:((

I clone repository switch to my branch and when i print git status i see modify files, i try to do git reset --hard but there was no effect :((

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 

推荐答案

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

The issue with having a core.autocrlf to input is that it can change eol (end of lines) characters even for (binary) documents that should not be touched.

尝试:

git config --global core.autocrlf false
git clone /url/your/repo

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

(meaning clone again your repo, and see if those diffs are still there)

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

With git 2.8 (March 2016), you will able to quickly check if those changes are eol-related.

请参见 Junio C Hamano-gitster-合并在

See commit a7630bd (16 Jan 2016) by Torsten Bögershausen (tboegi).
(Merged by Junio C Hamano -- gitster -- in commit 05f1539, 03 Feb 2016)

ls-files:添加EOL诊断信息

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

ls-files: add eol diagnostics

When working in a cross-platform environment, a user may want to check if text files are stored normalized in the repository and if .gitattributes are set appropriately.

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

Make it possible to let Git show the line endings in the index and in the working tree and the effective text/eol attributes.

行尾("eolinfo")如下所示:

The end of line ("eolinfo") are shown like this:

"-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.

有效的text/eol属性是其中之一:

The effective text/eol attribute is one of these:

"", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf"

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

git ls-files --eol gives an output like this:

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

以显示索引('i')中的数据使用了什么eol约定, 并在工作树('w')中,什么属性有效, 对于显示的每个路径.

to show what eol convention is used in the data in the index ('i'), and in the working tree ('w'), and what attribute is in effect, for each path that is shown.

这篇关于git show修改文件,但我不更改任何内容git reset不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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