Guido Caffa
Guido Caffa

Reputation: 1251

Files show diff in github desktop

I was working on my project, when suddenly, github shows me that I have a difference in more than 140 files, many of which I never modified. I started looking for the cause, and what I noticed was a warning saying "Warning: line endings have changed from 'LF' to 'CRLF'." This warning appeared in all the files that I had NOT modified. I was looking at different places, but I can not find a solution. I need to be able to identify which files I modified and which ones I did not.

When working with laravel and vuejs, many changes could be produced by compiling it, and I could not identify them.

I am working with Windows 10, github desktop and sublimetext as editor. Apparently what could cause this error was the compilation of vuejs.

enter image description here

Upvotes: 3

Views: 1002

Answers (1)

VonC
VonC

Reputation: 1323263

First, try again in a newly cloned repo, after having set git config --global core.autocrlf false: that will avoid Git changing anything automatically.

Second, as in this vuejs project, you could decide that all file should have lf end-of-line style (with Git 2.10+):

# Fix end-of-lines in Git versions older than 2.10
# https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248
* text=auto eol=lf

Then adding exception for small static binary resources you might need in your repo:

# ===
# Binary Files (don't diff, don't fix line endings)
# ===

# Images
*.png binary
*.jpg binary
...

Upvotes: 1

Related Questions