Information Technology Reference
In-Depth Information
$ git add -A
$ git commit -m " Standardization: committing line
endings changed to CRLF"
Now the most recent revision stored in the database in the repository 13-04 contains
the line endings presented in
Table 13-4
.
Table 13-4
.
The line endings in the three snapshots in the final state of the repository
13-04
How It Works
If you:
• Turn on the conversion of line endings with
$ git config --local
core.autocrlf true
• Remove the tracked files
• Check the tracked files out
the files that previously used
LF
, such as
linux/abcd.txt
, will use
CRLF
. The
content of the file is changed—it was
LF
and now it is
CRLF
, but
$ git status
re-
ports that the working directory is clean. This causes the following problem: how to
commit a file with changed line endings?
To do this you have to recreate the staging area with the line endings used in the
working directory:
• Turn off the conversion of line endings
$ git config --local
core.autocrlf false
• Remove the staging area with
$ rm .git/index