Information Technology Reference
In-Depth Information
Now the staging area and the working directory contain the files exactly as they
were stored in the HEAD revision. The line endings used in your repository are the
same as in Table 13-2 .
How It Works
If you set the option core.autocrlf to true and then clone the repository, the
files using LF line endings will be converted to use CRLF line endings. Thus right
after:
$ git clone 13-02 13-03
the file linux/abcd.txt now contains CRLF line endings. The files that contain
both LF and CRLF , such as mixed/abcd.txt , are not converted.
To perform a checkout that recreates all the files in the working directory and in the
staging area you have to:
• Remove all tracked files
• Remove the staging area
• Use the $ git reset command with the --hard option
The list of all tracked files is returned by the $ git ls-files command. If you
pass the resulting list to the $ rm command with xargs :
$ git ls-files | xargs rm
all tracked files will be removed from your working directory.
The staging area is stored in the .git/index file. You can remove this file with
the $ rm .git/index command.
After the above commands the staging area and the working directory do not con-
tain the files stored in HEAD anymore. As you already know you can recreate the work-
ing directory and the staging area with the $ git reset --hard command. This
command recreates the working directory and the staging area using the snapshot
stored in HEAD . If the operation is executed with core.autocrlf set to false
both the staging area and the working directory will be populated with files using the
original line endings (the ones stored in HEAD snapshot).
Search WWH ::




Custom Search