Information Technology Reference
In-Depth Information
All three snapshots use exactly the same line endings.
13-3. Checking out files without line-end-
ing conversion
Problem
Your git configuration contains the
core.autocrlf
option set to
true
. Therefore
when you clone a repository the line endings in the working directory are converted to
CRLF
.
You have just cloned the repository with
core.autocrlf
set to
true
. Your in-
tention was to make the files in the working directory exactly the same as in the data-
base. Because
core.autocrlf
was set to
true
you have created a clone that you
consider corrupted. You want to correct your mistake.
Your task is to checkout all the files once again. This time you want to avoid any
conversion of line endings. You want the line endings in your working directory to
match the line endings stored in HEAD revision in the database.
Solution
To understand the solution, you first need to create a repository containing corrupted
files.
Set the
core.autocrlf
to
true
with:
$ git config --global core.autocrlf true
and then clone the repository from previous recipe: