4

I am new to git and I am confused by this error message that keeps popping up when I commit:
"warning: LF will be replaced by CRLF in New Full Car.mdl. The file will have its original line endings in your working directory."

What does this mean? How can I prevent it from showing me the error on a regular basis?

Mikulas Dite
  • 7,790
  • 9
  • 59
  • 99
PlTaylor
  • 7,345
  • 11
  • 52
  • 94
  • 1
    possible duplicate of [Make CRLF warnings go away,](http://stackoverflow.com/questions/1598260/make-crlf-warnings-go-away) – Nate Oct 20 '11 at 13:34
  • It might be a poor duplicate of that question. I honestly didn't know enough when I was writing the question to know it was a Line feed error. See my comment in the first answer to understand where I was coming from. – PlTaylor Oct 20 '11 at 14:02
  • It wasn't meant personally. Those sort of comments are merely to direct the attention of future viewers of this question, so that it acts as a "sign-post" of sorts. – Nate Oct 20 '11 at 14:30
  • No offense taking. I appreciate you pointing out that thread as it helped me further understand the actual problem. I was just further explaining the question with a little more hindsight. – PlTaylor Oct 24 '11 at 12:32

2 Answers2

7

This has to do with the core.autocrlf global config option. See this page on github and check out these stackoverflow answers, and more.

Community
  • 1
  • 1
Nate
  • 12,499
  • 5
  • 45
  • 60
  • 1
    Thanks for clearing this up for me. I use the abbreviation LF in my file a lot for Left Front (it's a car model and LF, RF, LR, RR are common abbreviations) so I was afraid it was replacing those. I honestly didn't even think about the line feed connection. – PlTaylor Oct 20 '11 at 13:55
2

It sounds like git is replacing your linefeeds (LF) with carriage-return line feeds (CRLF), so it's swapping the end line characters on the repository side while leaving them alone in your current working directory. See this link for a description of newline characters.

If you want to avoid seeing that you could just change the newline characters in the New Full Car.mdl - it might do this when you pull from the repository, though if you've already pulled before it looks like it hasn't.

thegrinner
  • 11,546
  • 5
  • 41
  • 64