I've just installed the latest Git (1.9.5), and suddenly it tells me that my working tree is not clean (changes are not staged), but I can't see any changes in any of my files in any diff tool (I tried Tortoise and Visual Studio's built in). When I run git status, it says:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: inc/i_lab_orders.asp
modified: lab_order_list.asp
modified: slib/lab_order_lib.asp
However, Git GUI's diff tool tells me that all lines are changed, but I can't spot any difference. Same with the git bash's diff.
Running git reset --hard
doesn't help at all -- the command executes w/o any problems, but in the end I still have the same "changed" files.
UPDATE: core.autocrlf is false, core.fileMode is also false. I also noticed that the files that are reported to be changed are exactly the ones that were committed in the last commit.
I'm on Windows.
Welcome to hell. Enjoy your stay :-)
The difference that you can't see is the line ending. In a nutshell, you have told Git to convert all line endings to Windows or Unix and there is a file in the repo which has different line endings in the repo.
When you check out the file, Git does the conversion, creating a local file which looks correct. When you do a diff
, Git doesn't convert (because the file on disk must be correct and why would it convert what is already in the repo?) and now you get differences which aren't there.
Solution: Make sure that Git is configured correctly for every developer who can push
, commit the file once with the correct endings and get a silly hat for anyone to wear who creates files with wrong line endings.
Related:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With