Home·Error messages

git · Git

The message

The file will have its original line endings in your working directory

What it means

This is the second half of the CRLF notice above: it says the file on disk keeps whatever line endings it already has, and only the copy stored in the commit is normalised. It comes from the same autocrlf setting, so nothing here is broken by itself. But if diffs show whole files changed, that is a sign your team's line endings differ, so pin the rule with a .gitattributes in the repository and run git add --renormalize . once. That command rewrites only how endings are stored; it does not change file content.

The fix

There is no one-line command for this. The explanation says what to look at instead.

Printed by
git
Git
29

Almost every git error is a refusal that means "doing that from this state would lose something"; fatal: means git stopped without changing anything, and the hint: lines under the first line usually carry the actual remedy.

Reading an error message

  • Read from the first line down. The lower you go the more it is about the tool’s internals; the cause is usually at the top.
  • If there is a file and a line number, start there — not the top stack frame, but the topmost line that names a file you wrote.
  • Search the message verbatim, but strip your own paths and variable names first; those are what stop the search from matching.
  • The same condition is worded differently across tool versions. If results look wrong, add the version number to the query.
  • Before pasting a fix, check what it throws away. Some of these cannot be undone.

Common questions

Q. What does “The file will have its original line endings in your working directory” mean?

This is the second half of the CRLF notice above: it says the file on disk keeps whatever line endings it already has, and only the copy stored in the commit is normalised. It comes from the same autocrlf setting, so nothing here is broken by itself. But if diffs show whole files changed, that is a sign your team's line endings differ, so pin the rule with a .gitattributes in the repository and run git add --renormalize . once. That command rewrites only how endings are stored; it does not change file content.

Q. How do I fix it?

There is no one-line command. The explanation above says what to look at instead.

Q. Which tool prints this?

git. It sits under Git, and the message runs to 12 words.

Errors nearby