Information Technology Reference
In-Depth Information
Check the status of all files with
$ git status -sb
. As you can see this time
both
mixed/abcd.txt
and
windows/abcd.txt
are listed as modified. Finish
the recipe committing all changed files with:
$ git snapshot Standardization: line endings changed to
LF.
All three snapshots
HEAD
, the working directory, and the staging area now contain
LF
line endings. The result of Recipe 13-5 is summarized in
Table 13-5
.
Table 13-5
.
The line endings in the three snapshots in the final state of the repository
13-05
Notice that this recipe converted the file
mixed/abcd.txt
.
How It Works
The procedure described in this recipe uses the following
.gitattributes
entry:
* text=auto
Thanks to the above rule, when checked-in, all text files will be converted to use
LF
.
If you recreate the staging area with the two commands
$ rm .git/index
and
$ git reset
then
$ git status
will inform you that the files are changed. The
next commit operation will save in the database, files with
LF
line endings.