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 [-a | --all | <attr>...] [--] <pathname>...
10       git check-attr --stdin [-z] [-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       --
36           Interpret all preceding arguments as attributes and all following
37           arguments as path names.
38
39       If none of --stdin, --all, or -- is used, the first argument will be
40       treated as an attribute and the rest of the arguments as pathnames.
41

OUTPUT

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

EXAMPLES

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

SEE ALSO

105       gitattributes(5).
106

GIT

108       Part of the git(1) suite
109
110
111
112Git 2.39.1                        2023-01-13                 GIT-CHECK-ATTR(1)
Impressum