affect all repositories
for a single user should be placed in a file specified by the
`core.attributesFile` configuration option (see linkgit:git-config[1]).
Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME
is either not set or empty, $HOME/.config/git/attributes is used instead.
Attributes for all users on a system should be placed in the
`$(prefix)/etc/gitattributes` file.
Sometimes you would need to override a setting of an attribute
for a path to `Unspecified` state. This can be done by listing
the name of the attribute prefixed with an exclamation point `!`.
RESERVED BUILTIN_* ATTRIBUTES
-----------------------------
builtin_* is a reserved namespace for builtin attribute values. Any
user defined attributes under this namespace will be ignored and
trigger a warning.
`builtin_objectmode`
~~~~~~~~~~~~~~~~~~~~
This attribute is for filtering files by their file bit modes (40000,
120000, 160000, 100755, 100644). e.g. ':(attr:builtin_objectmode=160000)'.
You may also check these values with `git check-attr builtin_objectmode -- <file>`.
If the object is not in the index `git check-attr --cached` will return unspecified.
EFFECTS
-------
Certain operations by Git can be influenced by assigning
particular attributes to a path. Currently, the following
operations are attributes-aware.
Checking-out and checking-in
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These attributes affect how the contents stored in the
repository are copied to the working tree files when commands
such as 'git switch', 'git checkout' and 'git merge' run.
They also affect how
Git stores the contents you prepare in the working tree in the
repository upon 'git add' and 'git commit'.
`text`
^^^^^^
This attribute marks the path as a text file, which enables end-of-line
conversion: When a matching file is added to the index, the file's line
endings are normalized to LF in the index. Conversely, when the file is
copied from the index to the working directory, its line endings may be
converted from LF to CRLF depending on the `eol` attribute, the Git
config, and the platform (see explanation of `eol` below).
Set::
Setting the `text` attribute on a path enables end-of-line
conversion on checkin and checkout as described above. Line endings
are normalized to LF in the index every time the file is checked in,
even if the file was previously added to Git with CRLF line endings.
Unset::
Unsetting the `text` attribute on a path tells Git not to
attempt any end-of-line conversion upon checkin or checkout.
Set to string value "auto"::
When `text` is set to "auto", Git decides by itself whether the file
is text or binary. If it is text and the file was not already in
Git with CRLF endings, line endings are converted on checkin and
checkout as described above. Otherwise, no conversion is done on
checkin or checkout.
Unspecified::
If the `text` attribute is unspecified, Git uses the
`core.autocrlf` configuration variable to determine if the
file 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`