1GIT-CHECK-ATTR(1) Git Manual GIT-CHECK-ATTR(1)
2
3
4
6 git-check-attr - Display gitattributes information
7
9 git check-attr [-a | --all | <attr>...] [--] <pathname>...
10 git check-attr --stdin [-z] [-a | --all | <attr>...]
11
12
14 For every pathname, this command will list if each attribute is
15 unspecified, set, or unset as a gitattribute on that pathname.
16
18 -a, --all
19 List all attributes that are associated with the specified paths.
20 If this option is used, then unspecified attributes will not be
21 included in the output.
22
23 --cached
24 Consider .gitattributes in the index only, ignoring the working
25 tree.
26
27 --stdin
28 Read pathnames from the standard input, one per line, instead of
29 from the command-line.
30
31 -z
32 The output format is modified to be machine-parseable. If --stdin
33 is also given, input paths are separated with a NUL character
34 instead of a linefeed character.
35
36 --
37 Interpret all preceding arguments as attributes and all following
38 arguments as path names.
39
40 If none of --stdin, --all, or -- is used, the first argument will be
41 treated as an attribute and the rest of the arguments as pathnames.
42
44 The output is of the form: <path> COLON SP <attribute> COLON SP <info>
45 LF
46
47 unless -z is in effect, in which case NUL is used as delimiter: <path>
48 NUL <attribute> NUL <info> NUL
49
50 <path> is the path of a file being queried, <attribute> is an attribute
51 being queried and <info> can be either:
52
53 unspecified
54 when the attribute is not defined for the path.
55
56 unset
57 when the attribute is defined as false.
58
59 set
60 when the attribute is defined as true.
61
62 <value>
63 when a value has been assigned to the attribute.
64
65 Buffering happens as documented under the GIT_FLUSH option in git(1).
66 The caller is responsible for avoiding deadlocks caused by overfilling
67 an input buffer or reading from an empty output buffer.
68
70 In the examples, the following .gitattributes file is used:
71
72 *.java diff=java -crlf myAttr
73 NoMyAttr.java !myAttr
74 README caveat=unspecified
75
76
77
78 · Listing a single attribute:
79
80 $ git check-attr diff org/example/MyClass.java
81 org/example/MyClass.java: diff: java
82
83
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
93
94 · Listing all attributes for a file:
95
96 $ git check-attr --all -- org/example/MyClass.java
97 org/example/MyClass.java: diff: java
98 org/example/MyClass.java: myAttr: set
99
100
101
102 · Listing an attribute for multiple files:
103
104 $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
105 org/example/MyClass.java: myAttr: set
106 org/example/NoMyAttr.java: myAttr: unspecified
107
108
109
110 · Not all values are equally unambiguous:
111
112 $ git check-attr caveat README
113 README: caveat: unspecified
114
115
117 gitattributes(5).
118
120 Part of the git(1) suite
121
122
123
124Git 2.24.1 12/10/2019 GIT-CHECK-ATTR(1)