0

If I open a random file on Sublime and just save it, without make any change, the file appears as modified on git.

Why this happens and how can I avoid this?

marcelo2605
  • 2,734
  • 4
  • 29
  • 55
  • 2
    What is the output of `git diff`? – keltar Dec 03 '15 at 15:33
  • Something like this: "warning: LF will be replaced by CRLF in assets/styles/common/_variables.scss. The file will have its original line endings in your working directory." – marcelo2605 Dec 03 '15 at 15:38
  • You have incompatible line endings in systems that are using your repository. See [here](http://stackoverflow.com/questions/33574435/git-when-used-with-mac-and-windows-simultaneously-gives-unnecessary-conflicts) for one example. – sendaran Dec 03 '15 at 15:42

2 Answers2

1

Your editor has changed the Carriage Return (CR) or Line feed (LF) from one standard (e.g., Unix, Windows) to another. So the file has actually been changed, even if you can't see the change using a normal editor.

Claudio
  • 10,614
  • 4
  • 31
  • 71
0

I fix my problem editing my editor config file. Changing this line:

end_of_line = lf

by this:

end_of_line = crlf

And save all unchanged files again.

More info here: http://editorconfig.org/

marcelo2605
  • 2,734
  • 4
  • 29
  • 55