Information Technology Reference
In-Depth Information
3. Restore all tracked files with
$ git reset --hard
The file
linux/abcd.txt
stored in the working directory now uses
CRLF
line
endings. You want to commit this file into the repository in such a way that the object
stored in the database uses
CRLF
line endings. But the command
$ git status -
sb
prints the information that the working directory is clean. Therefore you cannot
commit this file with the simple
$ git add
and
$ git commit
commands.
To commit the
linux/abcd.txt
file with a
CRLF
line ending you have to up-
date the staging area. Follow this procedure:
4. Set the
core.autocrlf
option to
false
with
$ git config --
local core.autocrlf false
5. Remove the staging area with
$ rm .git/index
6. Recreate the
.git/index
file with
$ git reset
Check the status of all files with
$ git status -sb
. As you can see the file
linux/abcd.txt
is listed as modified. The command:
$ git diff
outputs:
-linux
- a
- b
- c
+linux ^M
+ a ^M
+ b ^M
+ c ^M
In the above output the characters
^M
represent
CR
. We can say that the file
linux/abcd.txt
was changed in such a way that every line contains a new
CR
character.
Because
$ git status -sb
prints the information that the repository is dirty,
you can create a new commit. Finish the recipe committing all changed files with