should be converted.
Any other value causes Git to act as if `text` has been left
unspecified.
`eol`
^^^^^
This attribute marks a path to use a specific line-ending style in the
working tree when it is checked out. It has effect only if `text` or
`text=auto` is set (see above), but specifying `eol` automatically sets
`text` if `text` was left unspecified.
Set to string value "crlf"::
This setting converts the file's line endings in the working
directory to CRLF when the file is checked out.
Set to string value "lf"::
This setting uses the same line endings in the working directory as
in the index when the file is checked out.
Unspecified::
If the `eol` attribute is unspecified for a file, its line endings
in the working directory are determined by the `core.autocrlf` or
`core.eol` configuration variable (see the definitions of those
options in linkgit:git-config[1]). If `text` is set but neither of
those variables is, the default is `eol=crlf` on Windows and
`eol=lf` on all other platforms.
Backwards compatibility with `crlf` attribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For backwards compatibility, the `crlf` attribute is interpreted as
follows:
------------------------
crlf text
-crlf -text
crlf=input eol=lf
------------------------
End-of-line conversion
^^^^^^^^^^^^^^^^^^^^^^
While Git normally leaves file contents alone, it can be configured to
normalize line endings to LF in the repository and, optionally, to
convert them to CRLF when files are checked out.
If you simply want to have CRLF line endings in your working directory
regardless of the repository you are working with, you can set the
config variable "core.autocrlf" without using any attributes.
------------------------
[core]
autocrlf = true
------------------------
This does not force normalization of text files, but does ensure
that text files that you introduce to the repository have their line
endings normalized to LF when they are added, and that files that are
already normalized in the repository stay normalized.
If you want to ensure that text files that any contributor introduces to
the repository have their line endings normalized, you can set the
`text` attribute to "auto" for _all_ files.
------------------------
* text=auto
------------------------
The attributes allow a fine-grained control, how the line endings
are converted.
Here is an example that will make Git normalize .txt, .vcproj and .sh
files, ensure that .vcproj files have CRLF and .sh files have LF in
the working directory, and prevent .jpg files from being normalized
regardless of their content.
------------------------
* text=auto
*.txt text
*.vcproj text eol=crlf
*.sh text eol=lf
*.jpg -text
------------------------
NOTE: When `text=auto` conversion is enabled in a cross-platform
project using push and pull to a central repository the text files
containing CRLFs should be normalized.
From a clean working directory:
-------------------------------------------------
$ echo "* text=auto" >.gitattributes
$ git add --renormalize .
$ git status # Show files that will be normalized
$ git commit -m "Introduce end-of-line normalization"
-------------------------------------------------
If any files that should not be normalized show up in 'git status',
unset their `text` attribute before running 'git add -u'.
------------------------
manual.pdf -text
------------------------
Conversely, text files that Git does not detect can have normalization
enabled manually.
------------------------
weirdchars.txt text
------------------------
If `core.safecrlf` is set to "true" or "warn", Git verifies if
the conversion is reversible for the current setting of
`core.autocrlf`. For "true", Git rejects irreversible
conversions; for "warn", Git only prints a warning but accepts
an irreversible conversion. The safety triggers to prevent such
a conversion done to the files in the work tree, but there are a
few exceptions. Even though...