Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git show modify files but i don't change anything git reset did not work

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 
like image 511
Ivan Avatar asked Dec 19 '14 21:12

Ivan


People also ask

Why does git show that all my files changed when I didn't change them?

These changes mean that metadata about your file changed, however the content of your file did not. If you're working in a group, this may start to intefere with pushes or just add noise to your commits.

What would happen if you ran the git reset?

It resets the index, but not the work tree. This means all your files are intact, but any differences between the original commit and the one you reset to will show up as local modifications (or untracked files) with git status.


2 Answers

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.

Try:

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

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


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

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

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

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.

The effective text/eol attribute is one of these:

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

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

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.

like image 84
VonC Avatar answered Oct 18 '22 09:10

VonC


I also met same problem. When i run command git diff, the result is:

Binary files a/app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf and b/app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf differ
warning: CRLF will be replaced by LF in app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf.
The file will have its original line endings in your working directory.

I tried git reset --hard . but it did not work. But when *.ttf binary is appended into .gitattributes file, the reset command worked.

Cheer.

like image 29
Nguyen Van Vinh Avatar answered Oct 18 '22 09:10

Nguyen Van Vinh