1GIT-CHECK-ATTR(1)                 Git Manual                 GIT-CHECK-ATTR(1)
2
3
4

NAME

6       git-check-attr - Display gitattributes information
7

SYNOPSIS

9       git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
10       git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
11

DESCRIPTION

13       For every pathname, this command will list if each attribute is
14       unspecified, set, or unset as a gitattribute on that pathname.
15

OPTIONS

17       -a, --all
18           List all attributes that are associated with the specified paths.
19           If this option is used, then unspecified attributes will not be
20           included in the output.
21
22       --cached
23           Consider .gitattributes in the index only, ignoring the working
24           tree.
25
26       --stdin
27           Read pathnames from the standard input, one per line, instead of
28           from the command line.
29
30       -z
31           The output format is modified to be machine-parsable. If --stdin is
32           also given, input paths are separated with a NUL character instead
33           of a linefeed character.
34
35       --source=<tree-ish>
36           Check attributes against the specified tree-ish. It is common to
37           specify the source tree by naming a commit, branch, or tag
38           associated with it.
39
40       --
41           Interpret all preceding arguments as attributes and all following
42           arguments as path names.
43
44       If none of --stdin, --all, or -- is used, the first argument will be
45       treated as an attribute and the rest of the arguments as pathnames.
46

OUTPUT

48       The output is of the form: <path> COLON SP <attribute> COLON SP <info>
49       LF
50
51       unless -z is in effect, in which case NUL is used as delimiter: <path>
52       NUL <attribute> NUL <info> NUL
53
54       <path> is the path of a file being queried, <attribute> is an attribute
55       being queried, and <info> can be either:
56
57       unspecified
58           when the attribute is not defined for the path.
59
60       unset
61           when the attribute is defined as false.
62
63       set
64           when the attribute is defined as true.
65
66       <value>
67           when a value has been assigned to the attribute.
68
69       Buffering happens as documented under the GIT_FLUSH option in git(1).
70       The caller is responsible for avoiding deadlocks caused by overfilling
71       an input buffer or reading from an empty output buffer.
72

EXAMPLES

74       In the examples, the following .gitattributes file is used:
75
76           *.java diff=java -crlf myAttr
77           NoMyAttr.java !myAttr
78           README caveat=unspecified
79
80       •   Listing a single attribute:
81
82           $ git check-attr diff org/example/MyClass.java
83           org/example/MyClass.java: diff: java
84
85       •   Listing multiple attributes for a file:
86
87           $ git check-attr crlf diff myAttr -- org/example/MyClass.java
88           org/example/MyClass.java: crlf: unset
89           org/example/MyClass.java: diff: java
90           org/example/MyClass.java: myAttr: set
91
92       •   Listing all attributes for a file:
93
94           $ git check-attr --all -- org/example/MyClass.java
95           org/example/MyClass.java: diff: java
96           org/example/MyClass.java: myAttr: set
97
98       •   Listing an attribute for multiple files:
99
100           $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
101           org/example/MyClass.java: myAttr: set
102           org/example/NoMyAttr.java: myAttr: unspecified
103
104       •   Not all values are equally unambiguous:
105
106           $ git check-attr caveat README
107           README: caveat: unspecified
108

SEE ALSO

110       gitattributes(5).
111

GIT

113       Part of the git(1) suite
114
115
116
117Git 2.43.0                        11/20/2023                 GIT-CHECK-ATTR(1)
Impressum