Information Technology Reference
In-Depth Information
The files in the working directory and in the staging area are exactly the same.
How It Works
Git configuration contains an option
core.autocrlf
. This option governs the way
git handles line-ending conversion. It can take three different values:
true
,
input
,
and
false
. Because conversion of line endings can be performed during checkout or
when you commit your files, we have to analyze the meaning of every value in both
situations.
The first value,
true
, affects both checkout and check-in. During checkout git con-
verts
LF
characters to
CRLF
. When you commit, reversed conversion is performed:
CRLF
line endings are converted to
LF
.
The second value,
input
, turns on conversion from
CRLF
to
LF
during check-in
operation. There is no conversion when you perform checkout with this setting.
The last value,
false
, turns off all conversions. The files stored in the object data-
base have the same line endings as the files in your working directory.
Table 13-1
.
All values of the core.autocrlf option and their influence on checkout and
commit
Value
Checkout
Commit
true
LF => CRLF
CRLF => LF
input
None
CRLF => LF
false
None
None
As you remember from Recipe 8-4 and from Table 8-1, your repository consists of
three snapshots. We can denote them as
HEAD
, the staging area, and the working dir-
ectory. In the repository 13-02 these three areas contain the line endings shown in
Table 13-2
.
The line endings in the three snapshots in the repository 13-02