Information Technology Reference
In-Depth Information
• Recreate
.git/index
file with
$ git reset
Now
$ git status
prints the information that the working directory is dirty.
You can commit the
linux/abcd.txt
file with
CRLF
line endings into the data-
base.
13-5. Converting line endings to LF and
committing the change
Problem
You work in a repository that contains different encodings of new lines. You want to:
• Convert the files in the working directory in such a way that they use
LF
line endings
• Commit the files with line endings converted to
LF
as a new revision.
The objects stored in the git database should contain
LF
line endings.
Solution
Clone the repository from Recipe 13-1:
$ cd git-recipes
$ git clone 13-02 13-05
$ cd 13-05
and follow this procedure:
1. Create the file
.gitattributes
files with one rule
* text=auto
.
You can do it with
$ echo "* text=auto"
>>.gitattributes
2. Remove the staging area with
$ rm .git/index
3. Recreate the
.git/index
file with
$ git reset