6 git-check-attr - Display gitattributes information
12 'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
13 'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
17 For every pathname, this command will list if each attribute is 'unspecified',
18 'set', or 'unset' as a gitattribute on that pathname.
23 List all attributes that are associated with the specified
24 paths. If this option is used, then 'unspecified' attributes
25 will not be included in the output.
28 Consider `.gitattributes` in the index only, ignoring the working tree.
31 Read pathnames from the standard input, one per line,
32 instead of from the command line.
35 The output format is modified to be machine-parsable.
36 If `--stdin` is also given, input paths are separated
37 with a NUL character instead of a linefeed character.
40 Check attributes against the specified tree-ish. It is common to
41 specify the source tree by naming a commit, branch, or tag associated
45 Interpret all preceding arguments as attributes and all following
46 arguments as path names.
48 If none of `--stdin`, `--all`, or `--` is used, the first argument
49 will be treated as an attribute and the rest of the arguments as
55 The output is of the form:
56 <path> COLON SP <attribute> COLON SP <info> LF
58 unless `-z` is in effect, in which case NUL is used as delimiter:
59 <path> NUL <attribute> NUL <info> NUL
62 <path> is the path of a file being queried, <attribute> is an attribute
63 being queried, and <info> can be either:
65 'unspecified';; when the attribute is not defined for the path.
66 'unset';; when the attribute is defined as false.
67 'set';; when the attribute is defined as true.
68 <value>;; when a value has been assigned to the attribute.
70 Buffering happens as documented under the `GIT_FLUSH` option in
71 linkgit:git[1]. The caller is responsible for avoiding deadlocks
72 caused by overfilling an input buffer or reading from an empty output
78 In the examples, the following '.gitattributes' file is used:
80 *.java diff=java -crlf myAttr
82 README caveat=unspecified
85 * Listing a single attribute:
87 $ git check-attr diff org/example/MyClass.java
88 org/example/MyClass.java: diff: java
91 * Listing multiple attributes for a file:
93 $ git check-attr crlf diff myAttr -- org/example/MyClass.java
94 org/example/MyClass.java: crlf: unset
95 org/example/MyClass.java: diff: java
96 org/example/MyClass.java: myAttr: set
99 * Listing all attributes for a file:
101 $ git check-attr --all -- org/example/MyClass.java
102 org/example/MyClass.java: diff: java
103 org/example/MyClass.java: myAttr: set
106 * Listing an attribute for multiple files:
108 $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
109 org/example/MyClass.java: myAttr: set
110 org/example/NoMyAttr.java: myAttr: unspecified
113 * Not all values are equally unambiguous:
115 $ git check-attr caveat README
116 README: caveat: unspecified
121 linkgit:gitattributes[5].
125 Part of the linkgit:git[1] suite