How to properly configure core.autocrlf on both working machines to avoid errors during "manual" file transfer?
I think it makes sense in all operating systems to assign this attribute at least the value of input .
then when adding βnon-normalizedβ files (i.e., crlf line delimiter ), a warning will be issued that the file in the repository will be converted, and the subsequent commit will automatically βnormalizeβ the file ( crlf separator will be replaced by lf ).
and when the checkout command is executed, no conversions will be made - the files in the working copy will have the same separators as in repository 1 .
perhaps in operating systems, where the default delimiter is not lf , but crlf (for example, ms / windows ), it makes sense to βgo furtherβ, and set the core.autocrlf attribute to true β so that , with the checkout command, the conversion lf β crlf is performed . but it probably makes sense only if the program used to view / edit these files displays the contents of the files incorrectly (i.e., does not make a line break when it encounters the lf symbol).
1 - see how the file is stored in the repository, for example, using the git cat-file -p Ρ
ΡΡ . example:
initialize the repository:
$ git init
add two lines to the file and commit:
$ echo 1 > file; echo 2 >> file $ git add file $ git commit -m 1 [master (root-commit) 1373ad1] 1 1 file changed, 2 insertions(+) create mode 100644 file
view the contents of the commit by specifying its hash (can be abbreviated):
$ git cat-file -p 1373ad1 tree d25d3b6082891168b6787cb20783bd332e5b8f74 ...
view the object of type tree added by this commit:
$ git cat-file -p d25d3b6 100644 blob 1191247b6d9a206f6ba3d8ac79e26d041dd86941 file
view the blob object containing the same file:
$ git cat-file -p 1191247 | hexdump -C 00000000 31 0a 32 0a |1.2.| 00000004
and see that it is preserved in the repository with the lf line delimiter.