2 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en">
4 <meta charset=
"UTF-8"/>
5 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge"/>
6 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0"/>
7 <meta name=
"generator" content=
"Asciidoctor 2.0.20"/>
8 <title>gitattributes(
5)
</title>
9 <link rel=
"stylesheet" href=
"https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"/>
11 /*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
12 /* Uncomment the following line when using as a custom stylesheet */
13 /* @import
"https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
14 html{font-family:sans-serif;-webkit-text-size-adjust:
100%}
16 a:focus{outline:thin dotted}
17 a:active,a:hover{outline:
0}
18 h1{font-size:
2em;margin:
.67em
0}
19 b,strong{font-weight:bold}
21 abbr[title]{cursor:help;border-bottom:
1px dotted #dddddf;text-decoration:none}
22 dfn{font-style:italic}
24 mark{background:#ff0;color:#
000}
25 code,kbd,pre,samp{font-family:monospace;font-size:
1em}
26 pre{white-space:pre-wrap}
27 q{quotes:
"\201C" "\201D" "\2018" "\2019"}
29 sub,sup{font-size:
75%;line-height:
0;position:relative;vertical-align:baseline}
33 svg:not(:root){overflow:hidden}
35 audio,video{display:inline-block}
36 audio:not([controls]){display:none;height:
0}
37 fieldset{border:
1px solid silver;margin:
0 2px;padding:
.35em
.625em
.75em}
38 legend{border:
0;padding:
0}
39 button,input,select,textarea{font-family:inherit;font-size:
100%;margin:
0}
40 button,input{line-height:normal}
41 button,select{text-transform:none}
42 button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
43 button[disabled],html input[disabled]{cursor:default}
44 input[type=checkbox],input[type=radio]{padding:
0}
45 button::-moz-focus-inner,input::-moz-focus-inner{border:
0;padding:
0}
46 textarea{overflow:auto;vertical-align:top}
47 table{border-collapse:collapse;border-spacing:
0}
48 *,::before,::after{box-sizing:border-box}
49 html,body{font-size:
100%}
50 body{background:#fff;color:rgba(
0,
0,
0,
.8);padding:
0;margin:
0;font-family:
"Noto Serif",
"DejaVu Serif",serif;line-height:
1;position:relative;cursor:auto;-moz-tab-size:
4;-o-tab-size:
4;tab-size:
4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
51 a:hover{cursor:pointer}
52 img,object,embed{max-width:
100%;height:auto}
53 object,embed{height:
100%}
54 img{-ms-interpolation-mode:bicubic}
55 .left{float:left!important}
56 .right{float:right!important}
57 .text-left{text-align:left!important}
58 .text-right{text-align:right!important}
59 .text-center{text-align:center!important}
60 .text-justify{text-align:justify!important}
62 img,object,svg{display:inline-block;vertical-align:middle}
63 textarea{height:auto;min-height:
50px}
65 .subheader,.admonitionblock td.content
>.title,.audioblock
>.title,.exampleblock
>.title,.imageblock
>.title,.listingblock
>.title,.literalblock
>.title,.stemblock
>.title,.openblock
>.title,.paragraph
>.title,.quoteblock
>.title,table.tableblock
>.title,.verseblock
>.title,.videoblock
>.title,.dlist
>.title,.olist
>.title,.ulist
>.title,.qlist
>.title,.hdlist
>.title{line-height:
1.45;color:#
7a2518;font-weight:
400;margin-top:
0;margin-bottom:
.25em}
66 div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:
0;padding:
0}
67 a{color:#
2156a5;text-decoration:underline;line-height:inherit}
68 a:hover,a:focus{color:#
1d4b8f}
70 p{line-height:
1.6;margin-bottom:
1.25em;text-rendering:optimizeLegibility}
71 p aside{font-size:
.875em;line-height:
1.35;font-style:italic}
72 h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-weight:
300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:
1em;margin-bottom:
.5em;line-height:
1.0125em}
73 h1 small,h2 small,h3 small,#toctitle small,.sidebarblock
>.content
>.title small,h4 small,h5 small,h6 small{font-size:
60%;color:#e99b8f;line-height:
0}
75 h2{font-size:
1.6875em}
76 h3,#toctitle,.sidebarblock
>.content
>.title{font-size:
1.375em}
77 h4,h5{font-size:
1.125em}
79 hr{border:solid #dddddf;border-width:
1px
0 0;clear:both;margin:
1.25em
0 1.1875em}
80 em,i{font-style:italic;line-height:inherit}
81 strong,b{font-weight:bold;line-height:inherit}
82 small{font-size:
60%;line-height:inherit}
83 code{font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;font-weight:
400;color:rgba(
0,
0,
0,
.9)}
84 ul,ol,dl{line-height:
1.6;margin-bottom:
1.25em;list-style-position:outside;font-family:inherit}
85 ul,ol{margin-left:
1.5em}
86 ul li ul,ul li ol{margin-left:
1.25em;margin-bottom:
0}
87 ul.circle{list-style-type:circle}
88 ul.disc{list-style-type:disc}
89 ul.square{list-style-type:square}
90 ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
91 ol li ul,ol li ol{margin-left:
1.25em;margin-bottom:
0}
92 dl dt{margin-bottom:
.3125em;font-weight:bold}
93 dl dd{margin-bottom:
1.25em}
94 blockquote{margin:
0 0 1.25em;padding:
.5625em
1.25em
0 1.1875em;border-left:
1px solid #ddd}
95 blockquote,blockquote p{line-height:
1.6;color:rgba(
0,
0,
0,
.85)}
96 @media screen and (min-width:
768px){h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{line-height:
1.2}
98 h2{font-size:
2.3125em}
99 h3,#toctitle,.sidebarblock
>.content
>.title{font-size:
1.6875em}
100 h4{font-size:
1.4375em}}
101 table{background:#fff;margin-bottom:
1.25em;border:
1px solid #dedede;word-wrap:normal}
102 table thead,table tfoot{background:#f7f8f7}
103 table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:
.5em
.625em
.625em;font-size:inherit;color:rgba(
0,
0,
0,
.8);text-align:left}
104 table tr th,table tr td{padding:
.5625em
.625em;font-size:inherit;color:rgba(
0,
0,
0,
.8)}
105 table tr.even,table tr.alt{background:#f8f8f7}
106 table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:
1.6}
107 h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{line-height:
1.2;word-spacing:-
.05em}
108 h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock
>.content
>.title strong,h4 strong,h5 strong,h6 strong{font-weight:
400}
109 .center{margin-left:auto;margin-right:auto}
111 .clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:
" ";display:table}
112 .clearfix::after,.float-group::after{clear:both}
113 :not(pre).nobreak{word-wrap:normal}
114 :not(pre).nowrap{white-space:nowrap}
115 :not(pre).pre-wrap{white-space:pre-wrap}
116 :not(pre):not([class^=L])
>code{font-size:
.9375em;font-style:normal!important;letter-spacing:
0;padding:
.1em
.5ex;word-spacing:-
.15em;background:#f7f7f8;border-radius:
4px;line-height:
1.45;text-rendering:optimizeSpeed}
117 pre{color:rgba(
0,
0,
0,
.9);font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;line-height:
1.45;text-rendering:optimizeSpeed}
118 pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
119 pre
>code{display:block}
120 pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
121 em em{font-style:normal}
122 strong strong{font-weight:
400}
123 .keyseq{color:rgba(
51,
51,
51,
.8)}
124 kbd{font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;display:inline-block;color:rgba(
0,
0,
0,
.8);font-size:
.65em;line-height:
1.45;background:#f7f7f7;border:
1px solid #ccc;border-radius:
3px;box-shadow:
0 1px
0 rgba(
0,
0,
0,
.2),inset
0 0 0 .1em #fff;margin:
0 .15em;padding:
.2em
.5em;vertical-align:middle;position:relative;top:-
.1em;white-space:nowrap}
125 .keyseq kbd:first-child{margin-left:
0}
126 .keyseq kbd:last-child{margin-right:
0}
127 .menuseq,.menuref{color:#
000}
128 .menuseq b:not(.caret),.menuref{font-weight:inherit}
129 .menuseq{word-spacing:-
.02em}
130 .menuseq b.caret{font-size:
1.25em;line-height:
.8}
131 .menuseq i.caret{font-weight:bold;text-align:center;width:
.45em}
132 b.button::before,b.button::after{position:relative;top:-
1px;font-weight:
400}
133 b.button::before{content:
"[";padding:
0 3px
0 2px}
134 b.button::after{content:
"]";padding:
0 2px
0 3px}
135 p a
>code:hover{color:rgba(
0,
0,
0,
.9)}
136 #header,#content,#footnotes,#footer{width:
100%;margin:
0 auto;max-width:
62.5em;*zoom:
1;position:relative;padding-left:
.9375em;padding-right:
.9375em}
137 #header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:
" ";display:table}
138 #header::after,#content::after,#footnotes::after,#footer::after{clear:both}
139 #content{margin-top:
1.25em}
140 #content::before{content:none}
141 #header
>h1:first-child{color:rgba(
0,
0,
0,
.85);margin-top:
2.25rem;margin-bottom:
0}
142 #header
>h1:first-child+#toc{margin-top:
8px;border-top:
1px solid #dddddf}
143 #header
>h1:only-child,body.toc2 #header
>h1:nth-last-child(
2){border-bottom:
1px solid #dddddf;padding-bottom:
8px}
144 #header .details{border-bottom:
1px solid #dddddf;line-height:
1.45;padding-top:
.25em;padding-bottom:
.25em;padding-left:
.25em;color:rgba(
0,
0,
0,
.6);display:flex;flex-flow:row wrap}
145 #header .details span:first-child{margin-left:-
.125em}
146 #header .details span.email a{color:rgba(
0,
0,
0,
.85)}
147 #header .details br{display:none}
148 #header .details br+span::before{content:
"\00a0\2013\00a0"}
149 #header .details br+span.author::before{content:
"\00a0\22c5\00a0";color:rgba(
0,
0,
0,
.85)}
150 #header .details br+span#revremark::before{content:
"\00a0|\00a0"}
151 #header #revnumber{text-transform:capitalize}
152 #header #revnumber::after{content:
"\00a0"}
153 #content
>h1:first-child:not([class]){color:rgba(
0,
0,
0,
.85);border-bottom:
1px solid #dddddf;padding-bottom:
8px;margin-top:
0;padding-top:
1rem;margin-bottom:
1.25rem}
154 #toc{border-bottom:
1px solid #e7e7e9;padding-bottom:
.5em}
155 #toc
>ul{margin-left:
.125em}
156 #toc ul.sectlevel0
>li
>a{font-style:italic}
157 #toc ul.sectlevel0 ul.sectlevel1{margin:
.5em
0}
158 #toc ul{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;list-style-type:none}
159 #toc li{line-height:
1.3334;margin-top:
.3334em}
160 #toc a{text-decoration:none}
161 #toc a:active{text-decoration:underline}
162 #toctitle{color:#
7a2518;font-size:
1.2em}
163 @media screen and (min-width:
768px){#toctitle{font-size:
1.375em}
164 body.toc2{padding-left:
15em;padding-right:
0}
165 #toc.toc2{margin-top:
0!important;background:#f8f8f7;position:fixed;width:
15em;left:
0;top:
0;border-right:
1px solid #e7e7e9;border-top-width:
0!important;border-bottom-width:
0!important;z-index:
1000;padding:
1.25em
1em;height:
100%;overflow:auto}
166 #toc.toc2 #toctitle{margin-top:
0;margin-bottom:
.8rem;font-size:
1.2em}
167 #toc.toc2
>ul{font-size:
.9em;margin-bottom:
0}
168 #toc.toc2 ul ul{margin-left:
0;padding-left:
1em}
169 #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:
0;margin-top:
.5em;margin-bottom:
.5em}
170 body.toc2.toc-right{padding-left:
0;padding-right:
15em}
171 body.toc2.toc-right #toc.toc2{border-right-width:
0;border-left:
1px solid #e7e7e9;left:auto;right:
0}}
172 @media screen and (min-width:
1280px){body.toc2{padding-left:
20em;padding-right:
0}
173 #toc.toc2{width:
20em}
174 #toc.toc2 #toctitle{font-size:
1.375em}
175 #toc.toc2
>ul{font-size:
.95em}
176 #toc.toc2 ul ul{padding-left:
1.25em}
177 body.toc2.toc-right{padding-left:
0;padding-right:
20em}}
178 #content #toc{border:
1px solid #e0e0dc;margin-bottom:
1.25em;padding:
1.25em;background:#f8f8f7;border-radius:
4px}
179 #content #toc
>:first-child{margin-top:
0}
180 #content #toc
>:last-child{margin-bottom:
0}
181 #footer{max-width:none;background:rgba(
0,
0,
0,
.8);padding:
1.25em}
182 #footer-text{color:hsla(
0,
0%,
100%,
.8);line-height:
1.44}
183 #content{margin-bottom:
.625em}
184 .sect1{padding-bottom:
.625em}
185 @media screen and (min-width:
768px){#content{margin-bottom:
1.25em}
186 .sect1{padding-bottom:
1.25em}}
187 .sect1:last-child{padding-bottom:
0}
188 .sect1+.sect1{border-top:
1px solid #e7e7e9}
189 #content h1
>a.anchor,h2
>a.anchor,h3
>a.anchor,#toctitle
>a.anchor,.sidebarblock
>.content
>.title
>a.anchor,h4
>a.anchor,h5
>a.anchor,h6
>a.anchor{position:absolute;z-index:
1001;width:
1.5ex;margin-left:-
1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:
400}
190 #content h1
>a.anchor::before,h2
>a.anchor::before,h3
>a.anchor::before,#toctitle
>a.anchor::before,.sidebarblock
>.content
>.title
>a.anchor::before,h4
>a.anchor::before,h5
>a.anchor::before,h6
>a.anchor::before{content:
"\00A7";font-size:
.85em;display:block;padding-top:
.1em}
191 #content h1:hover
>a.anchor,#content h1
>a.anchor:hover,h2:hover
>a.anchor,h2
>a.anchor:hover,h3:hover
>a.anchor,#toctitle:hover
>a.anchor,.sidebarblock
>.content
>.title:hover
>a.anchor,h3
>a.anchor:hover,#toctitle
>a.anchor:hover,.sidebarblock
>.content
>.title
>a.anchor:hover,h4:hover
>a.anchor,h4
>a.anchor:hover,h5:hover
>a.anchor,h5
>a.anchor:hover,h6:hover
>a.anchor,h6
>a.anchor:hover{visibility:visible}
192 #content h1
>a.link,h2
>a.link,h3
>a.link,#toctitle
>a.link,.sidebarblock
>.content
>.title
>a.link,h4
>a.link,h5
>a.link,h6
>a.link{color:#ba3925;text-decoration:none}
193 #content h1
>a.link:hover,h2
>a.link:hover,h3
>a.link:hover,#toctitle
>a.link:hover,.sidebarblock
>.content
>.title
>a.link:hover,h4
>a.link:hover,h5
>a.link:hover,h6
>a.link:hover{color:#a53221}
194 details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:
1.25em}
195 details{margin-left:
1.25rem}
196 details
>summary{cursor:pointer;display:block;position:relative;line-height:
1.6;margin-bottom:
.625rem;outline:none;-webkit-tap-highlight-color:transparent}
197 details
>summary::-webkit-details-marker{display:none}
198 details
>summary::before{content:
"";border:solid transparent;border-left:solid;border-width:
.3em
0 .3em
.5em;position:absolute;top:
.5em;left:-
1.25rem;transform:translateX(
15%)}
199 details[open]
>summary::before{border:solid transparent;border-top:solid;border-width:
.5em
.3em
0;transform:translateY(
15%)}
200 details
>summary::after{content:
"";width:
1.25rem;height:
1em;position:absolute;top:
.3em;left:-
1.25rem}
201 .admonitionblock td.content
>.title,.audioblock
>.title,.exampleblock
>.title,.imageblock
>.title,.listingblock
>.title,.literalblock
>.title,.stemblock
>.title,.openblock
>.title,.paragraph
>.title,.quoteblock
>.title,table.tableblock
>.title,.verseblock
>.title,.videoblock
>.title,.dlist
>.title,.olist
>.title,.ulist
>.title,.qlist
>.title,.hdlist
>.title{text-rendering:optimizeLegibility;text-align:left;font-family:
"Noto Serif",
"DejaVu Serif",serif;font-size:
1rem;font-style:italic}
202 table.tableblock.fit-content
>caption.title{white-space:nowrap;width:
0}
203 .paragraph.lead
>p,#preamble
>.sectionbody
>[class=paragraph]:first-of-type p{font-size:
1.21875em;line-height:
1.6;color:rgba(
0,
0,
0,
.85)}
204 .admonitionblock
>table{border-collapse:separate;border:
0;background:none;width:
100%}
205 .admonitionblock
>table td.icon{text-align:center;width:
80px}
206 .admonitionblock
>table td.icon img{max-width:none}
207 .admonitionblock
>table td.icon .title{font-weight:bold;font-family:
"Open Sans",
"DejaVu Sans",sans-serif;text-transform:uppercase}
208 .admonitionblock
>table td.content{padding-left:
1.125em;padding-right:
1.25em;border-left:
1px solid #dddddf;color:rgba(
0,
0,
0,
.6);word-wrap:anywhere}
209 .admonitionblock
>table td.content
>:last-child
>:last-child{margin-bottom:
0}
210 .exampleblock
>.content{border:
1px solid #e6e6e6;margin-bottom:
1.25em;padding:
1.25em;background:#fff;border-radius:
4px}
211 .sidebarblock{border:
1px solid #dbdbd6;margin-bottom:
1.25em;padding:
1.25em;background:#f3f3f2;border-radius:
4px}
212 .sidebarblock
>.content
>.title{color:#
7a2518;margin-top:
0;text-align:center}
213 .exampleblock
>.content
>:first-child,.sidebarblock
>.content
>:first-child{margin-top:
0}
214 .exampleblock
>.content
>:last-child,.exampleblock
>.content
>:last-child
>:last-child,.exampleblock
>.content .olist
>ol
>li:last-child
>:last-child,.exampleblock
>.content .ulist
>ul
>li:last-child
>:last-child,.exampleblock
>.content .qlist
>ol
>li:last-child
>:last-child,.sidebarblock
>.content
>:last-child,.sidebarblock
>.content
>:last-child
>:last-child,.sidebarblock
>.content .olist
>ol
>li:last-child
>:last-child,.sidebarblock
>.content .ulist
>ul
>li:last-child
>:last-child,.sidebarblock
>.content .qlist
>ol
>li:last-child
>:last-child{margin-bottom:
0}
215 .literalblock pre,.listingblock
>.content
>pre{border-radius:
4px;overflow-x:auto;padding:
1em;font-size:
.8125em}
216 @media screen and (min-width:
768px){.literalblock pre,.listingblock
>.content
>pre{font-size:
.90625em}}
217 @media screen and (min-width:
1280px){.literalblock pre,.listingblock
>.content
>pre{font-size:
1em}}
218 .literalblock pre,.listingblock
>.content
>pre:not(.highlight),.listingblock
>.content
>pre[class=highlight],.listingblock
>.content
>pre[class^=
"highlight "]{background:#f7f7f8}
219 .literalblock.output pre{color:#f7f7f8;background:rgba(
0,
0,
0,
.9)}
220 .listingblock
>.content{position:relative}
221 .listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:
.75em;top:
.425rem;right:
.5rem;line-height:
1;text-transform:uppercase;color:inherit;opacity:
.5}
222 .listingblock:hover code[data-lang]::before{display:block}
223 .listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:
.5em;color:inherit;opacity:
.5}
224 .listingblock.terminal pre .command:not([data-prompt])::before{content:
"$"}
225 .listingblock pre.highlightjs{padding:
0}
226 .listingblock pre.highlightjs
>code{padding:
1em;border-radius:
4px}
227 .listingblock pre.prettyprint{border-width:
0}
228 .prettyprint{background:#f7f7f8}
229 pre.prettyprint .linenums{line-height:
1.45;margin-left:
2em}
230 pre.prettyprint li{background:none;list-style-type:inherit;padding-left:
0}
231 pre.prettyprint li code[data-lang]::before{opacity:
1}
232 pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
233 table.linenotable{border-collapse:separate;border:
0;margin-bottom:
0;background:none}
234 table.linenotable td[class]{color:inherit;vertical-align:top;padding:
0;line-height:inherit;white-space:normal}
235 table.linenotable td.code{padding-left:
.75em}
236 table.linenotable td.linenos,pre.pygments .linenos{border-right:
1px solid;opacity:
.35;padding-right:
.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
237 pre.pygments span.linenos{display:inline-block;margin-right:
.75em}
238 .quoteblock{margin:
0 1em
1.25em
1.5em;display:table}
239 .quoteblock:not(.excerpt)
>.title{margin-left:-
1.5em;margin-bottom:
.75em}
240 .quoteblock blockquote,.quoteblock p{color:rgba(
0,
0,
0,
.85);font-size:
1.15rem;line-height:
1.75;word-spacing:
.1em;letter-spacing:
0;font-style:italic;text-align:justify}
241 .quoteblock blockquote{margin:
0;padding:
0;border:
0}
242 .quoteblock blockquote::before{content:
"\201c";float:left;font-size:
2.75em;font-weight:bold;line-height:
.6em;margin-left:-
.6em;color:#
7a2518;text-shadow:
0 1px
2px rgba(
0,
0,
0,
.1)}
243 .quoteblock blockquote
>.paragraph:last-child p{margin-bottom:
0}
244 .quoteblock .attribution{margin-top:
.75em;margin-right:
.5ex;text-align:right}
245 .verseblock{margin:
0 1em
1.25em}
246 .verseblock pre{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-size:
1.15rem;color:rgba(
0,
0,
0,
.85);font-weight:
300;text-rendering:optimizeLegibility}
247 .verseblock pre strong{font-weight:
400}
248 .verseblock .attribution{margin-top:
1.25rem;margin-left:
.5ex}
249 .quoteblock .attribution,.verseblock .attribution{font-size:
.9375em;line-height:
1.45;font-style:italic}
250 .quoteblock .attribution br,.verseblock .attribution br{display:none}
251 .quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-
.025em;color:rgba(
0,
0,
0,
.6)}
252 .quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
253 .quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:
1.6;word-spacing:
0}
254 .quoteblock.abstract{margin:
0 1em
1.25em;display:block}
255 .quoteblock.abstract
>.title{margin:
0 0 .375em;font-size:
1.15em;text-align:center}
256 .quoteblock.excerpt
>blockquote,.quoteblock .quoteblock{padding:
0 0 .25em
1em;border-left:
.25em solid #dddddf}
257 .quoteblock.excerpt,.quoteblock .quoteblock{margin-left:
0}
258 .quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:
1.0625rem}
259 .quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:
.85rem;text-align:left;margin-right:
0}
260 p.tableblock:last-child{margin-bottom:
0}
261 td.tableblock
>.content{margin-bottom:
1.25em;word-wrap:anywhere}
262 td.tableblock
>.content
>:last-child{margin-bottom:-
1.25em}
263 table.tableblock,th.tableblock,td.tableblock{border:
0 solid #dedede}
264 table.grid-all
>*
>tr
>*{border-width:
1px}
265 table.grid-cols
>*
>tr
>*{border-width:
0 1px}
266 table.grid-rows
>*
>tr
>*{border-width:
1px
0}
267 table.frame-all{border-width:
1px}
268 table.frame-ends{border-width:
1px
0}
269 table.frame-sides{border-width:
0 1px}
270 table.frame-none
>colgroup+*
>:first-child
>*,table.frame-sides
>colgroup+*
>:first-child
>*{border-top-width:
0}
271 table.frame-none
>:last-child
>:last-child
>*,table.frame-sides
>:last-child
>:last-child
>*{border-bottom-width:
0}
272 table.frame-none
>*
>tr
>:first-child,table.frame-ends
>*
>tr
>:first-child{border-left-width:
0}
273 table.frame-none
>*
>tr
>:last-child,table.frame-ends
>*
>tr
>:last-child{border-right-width:
0}
274 table.stripes-all
>*
>tr,table.stripes-odd
>*
>tr:nth-of-type(odd),table.stripes-even
>*
>tr:nth-of-type(even),table.stripes-hover
>*
>tr:hover{background:#f8f8f7}
275 th.halign-left,td.halign-left{text-align:left}
276 th.halign-right,td.halign-right{text-align:right}
277 th.halign-center,td.halign-center{text-align:center}
278 th.valign-top,td.valign-top{vertical-align:top}
279 th.valign-bottom,td.valign-bottom{vertical-align:bottom}
280 th.valign-middle,td.valign-middle{vertical-align:middle}
281 table thead th,table tfoot th{font-weight:bold}
282 tbody tr th{background:#f7f8f7}
283 tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(
0,
0,
0,
.8);font-weight:bold}
284 p.tableblock
>code:only-child{background:none;padding:
0}
285 p.tableblock{font-size:
1em}
286 ol{margin-left:
1.75em}
287 ul li ol{margin-left:
1.5em}
288 dl dd{margin-left:
1.125em}
289 dl dd:last-child,dl dd:last-child
>:last-child{margin-bottom:
0}
290 li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:
.625em}
291 ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
292 ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:
.625em}
293 ul.unstyled,ol.unstyled{margin-left:
0}
294 li
>p:empty:only-child::before{content:
"";display:inline-block}
295 ul.checklist
>li
>p:first-child{margin-left:-
1em}
296 ul.checklist
>li
>p:first-child
>.fa-square-o:first-child,ul.checklist
>li
>p:first-child
>.fa-check-square-o:first-child{width:
1.25em;font-size:
.8em;position:relative;bottom:
.125em}
297 ul.checklist
>li
>p:first-child
>input[type=checkbox]:first-child{margin-right:
.25em}
298 ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:
0 0 .625em -
1.25em}
299 ul.inline
>li{margin-left:
1.25em}
300 .unstyled dl dt{font-weight:
400;font-style:normal}
301 ol.arabic{list-style-type:decimal}
302 ol.decimal{list-style-type:decimal-leading-zero}
303 ol.loweralpha{list-style-type:lower-alpha}
304 ol.upperalpha{list-style-type:upper-alpha}
305 ol.lowerroman{list-style-type:lower-roman}
306 ol.upperroman{list-style-type:upper-roman}
307 ol.lowergreek{list-style-type:lower-greek}
308 .hdlist
>table,.colist
>table{border:
0;background:none}
309 .hdlist
>table
>tbody
>tr,.colist
>table
>tbody
>tr{background:none}
310 td.hdlist1,td.hdlist2{vertical-align:top;padding:
0 .625em}
311 td.hdlist1{font-weight:bold;padding-bottom:
1.25em}
312 td.hdlist2{word-wrap:anywhere}
313 .literalblock+.colist,.listingblock+.colist{margin-top:-
.5em}
314 .colist td:not([class]):first-child{padding:
.4em
.75em
0;line-height:
1;vertical-align:top}
315 .colist td:not([class]):first-child img{max-width:none}
316 .colist td:not([class]):last-child{padding:
.25em
0}
317 .thumb,.th{line-height:
0;display:inline-block;border:
4px solid #fff;box-shadow:
0 0 0 1px #ddd}
318 .imageblock.left{margin:
.25em
.625em
1.25em
0}
319 .imageblock.right{margin:
.25em
0 1.25em
.625em}
320 .imageblock
>.title{margin-bottom:
0}
321 .imageblock.thumb,.imageblock.th{border-width:
6px}
322 .imageblock.thumb
>.title,.imageblock.th
>.title{padding:
0 .125em}
323 .image.left,.image.right{margin-top:
.25em;margin-bottom:
.25em;display:inline-block;line-height:
0}
324 .image.left{margin-right:
.625em}
325 .image.right{margin-left:
.625em}
326 a.image{text-decoration:none;display:inline-block}
327 a.image object{pointer-events:none}
328 sup.footnote,sup.footnoteref{font-size:
.875em;position:static;vertical-align:super}
329 sup.footnote a,sup.footnoteref a{text-decoration:none}
330 sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
331 #footnotes{padding-top:
.75em;padding-bottom:
.75em;margin-bottom:
.625em}
332 #footnotes hr{width:
20%;min-width:
6.25em;margin:-
.25em
0 .75em;border-width:
1px
0 0}
333 #footnotes .footnote{padding:
0 .375em
0 .225em;line-height:
1.3334;font-size:
.875em;margin-left:
1.2em;margin-bottom:
.2em}
334 #footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-
1.05em}
335 #footnotes .footnote:last-of-type{margin-bottom:
0}
336 #content #footnotes{margin-top:-
.625em;margin-bottom:
0;padding:
.75em
0}
337 div.unbreakable{page-break-inside:avoid}
338 .big{font-size:larger}
339 .small{font-size:smaller}
340 .underline{text-decoration:underline}
341 .overline{text-decoration:overline}
342 .line-through{text-decoration:line-through}
344 .aqua-background{background:#
00fafa}
346 .black-background{background:#
000}
348 .blue-background{background:#
0000fa}
349 .fuchsia{color:#bf00bf}
350 .fuchsia-background{background:#fa00fa}
352 .gray-background{background:#
7d7d7d}
353 .green{color:#
006000}
354 .green-background{background:#
007d00}
356 .lime-background{background:#
00fa00}
357 .maroon{color:#
600000}
358 .maroon-background{background:#
7d0000}
360 .navy-background{background:#
00007d}
361 .olive{color:#
606000}
362 .olive-background{background:#
7d7d00}
363 .purple{color:#
600060}
364 .purple-background{background:#
7d007d}
366 .red-background{background:#fa0000}
367 .silver{color:#
909090}
368 .silver-background{background:#bcbcbc}
370 .teal-background{background:#
007d7d}
371 .white{color:#bfbfbf}
372 .white-background{background:#fafafa}
373 .yellow{color:#bfbf00}
374 .yellow-background{background:#fafa00}
375 span.icon
>.fa{cursor:default}
376 a span.icon
>.fa{cursor:inherit}
377 .admonitionblock td.icon [class^=
"fa icon-"]{font-size:
2.5em;text-shadow:
1px
1px
2px rgba(
0,
0,
0,
.5);cursor:default}
378 .admonitionblock td.icon .icon-note::before{content:
"\f05a";color:#
19407c}
379 .admonitionblock td.icon .icon-tip::before{content:
"\f0eb";text-shadow:
1px
1px
2px rgba(
155,
155,
0,
.8);color:#
111}
380 .admonitionblock td.icon .icon-warning::before{content:
"\f071";color:#bf6900}
381 .admonitionblock td.icon .icon-caution::before{content:
"\f06d";color:#bf3400}
382 .admonitionblock td.icon .icon-important::before{content:
"\f06a";color:#bf0000}
383 .conum[data-value]{display:inline-block;color:#fff!important;background:rgba(
0,
0,
0,
.8);border-radius:
50%;text-align:center;font-size:
.75em;width:
1.67em;height:
1.67em;line-height:
1.67em;font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
384 .conum[data-value] *{color:#fff!important}
385 .conum[data-value]+b{display:none}
386 .conum[data-value]::after{content:attr(data-value)}
387 pre .conum[data-value]{position:relative;top:-
.125em}
388 b.conum *{color:inherit!important}
389 .conum:not([data-value]):empty{display:none}
390 dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
391 h1,h2,p,td.content,span.alt,summary{letter-spacing:-
.01em}
392 p strong,td.content strong,div.footnote strong{letter-spacing:-
.005em}
393 p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:
1.0625rem}
394 p{margin-bottom:
1.25rem}
395 .sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:
1em}
396 .exampleblock
>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:
0 1px
4px #e0e0dc}
397 .print-only{display:none!important}
398 @page{margin:
1.25cm
.75cm}
399 @media print{*{box-shadow:none!important;text-shadow:none!important}
401 a{color:inherit!important;text-decoration:underline!important}
402 a.bare,a[href^=
"#"],a[href^=
"mailto:"]{text-decoration:none!important}
403 a[href^=
"http:"]:not(.bare)::after,a[href^=
"https:"]:not(.bare)::after{content:
"(" attr(href)
")";display:inline-block;font-size:
.875em;padding-left:
.25em}
404 abbr[title]{border-bottom:
1px dotted}
405 abbr[title]::after{content:
" (" attr(title)
")"}
406 pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
407 thead{display:table-header-group}
409 p,blockquote,dt,td.content{font-size:
1em;orphans:
3;widows:
3}
410 h2,h3,#toctitle,.sidebarblock
>.content
>.title{page-break-after:avoid}
411 #header,#content,#footnotes,#footer{max-width:none}
412 #toc,.sidebarblock,.exampleblock
>.content{background:none!important}
413 #toc{border-bottom:
1px solid #dddddf!important;padding-bottom:
0!important}
414 body.book #header{text-align:center}
415 body.book #header
>h1:first-child{border:
0!important;margin:
2.5em
0 1em}
416 body.book #header .details{border:
0!important;display:block;padding:
0!important}
417 body.book #header .details span:first-child{margin-left:
0!important}
418 body.book #header .details br{display:block}
419 body.book #header .details br+span::before{content:none!important}
420 body.book #toc{border:
0!important;text-align:left!important;padding:
0!important;margin:
0!important}
421 body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1
>h2{page-break-before:always}
422 .listingblock code[data-lang]::before{display:block}
423 #footer{padding:
0 .9375em}
424 .hide-on-print{display:none!important}
425 .print-only{display:block!important}
426 .hide-for-print{display:none!important}
427 .show-for-print{display:inherit!important}}
428 @media amzn-kf8,print{#header
>h1:first-child{margin-top:
1.25rem}
429 .sect1{padding:
0!important}
430 .sect1+.sect1{border:
0}
431 #footer{background:none}
432 #footer-text{color:rgba(
0,
0,
0,
.6);font-size:
.9em}}
433 @media amzn-kf8{#header,#content,#footnotes,#footer{padding:
0}}
441 <body class=
"manpage">
443 <h1>gitattributes(
5) Manual Page
</h1>
444 <h2 id=
"_name">NAME
</h2>
445 <div class=
"sectionbody">
446 <p>gitattributes - Defining attributes per path
</p>
451 <h2 id=
"_synopsis">SYNOPSIS
</h2>
452 <div class=
"sectionbody">
453 <div class=
"paragraph">
454 <p>$GIT_DIR/info/attributes, .gitattributes
</p>
459 <h2 id=
"_description">DESCRIPTION
</h2>
460 <div class=
"sectionbody">
461 <div class=
"paragraph">
462 <p>A
<code>gitattributes
</code> file is a simple text file that gives
463 <code>attributes
</code> to pathnames.
</p>
465 <div class=
"paragraph">
466 <p>Each line in
<code>gitattributes
</code> file is of form:
</p>
468 <div class=
"literalblock">
469 <div class=
"content">
470 <pre>pattern attr1 attr2 ...
</pre>
473 <div class=
"paragraph">
474 <p>That is, a pattern followed by an attributes list,
475 separated by whitespaces. Leading and trailing whitespaces are
476 ignored. Lines that begin with
<em>#
</em> are ignored. Patterns
477 that begin with a double quote are quoted in C style.
478 When the pattern matches the path in question, the attributes
479 listed on the line are given to the path.
</p>
481 <div class=
"paragraph">
482 <p>Each attribute can be in one of these states for a given path:
</p>
486 <dt class=
"hdlist1">Set
</dt>
488 <p>The path has the attribute with special value
"true";
489 this is specified by listing only the name of the
490 attribute in the attribute list.
</p>
492 <dt class=
"hdlist1">Unset
</dt>
494 <p>The path has the attribute with special value
"false";
495 this is specified by listing the name of the attribute
496 prefixed with a dash
<code>-
</code> in the attribute list.
</p>
498 <dt class=
"hdlist1">Set to a value
</dt>
500 <p>The path has the attribute with specified string value;
501 this is specified by listing the name of the attribute
502 followed by an equal sign
<code>=
</code> and its value in the
505 <dt class=
"hdlist1">Unspecified
</dt>
507 <p>No pattern matches the path, and nothing says if
508 the path has or does not have the attribute, the
509 attribute for the path is said to be Unspecified.
</p>
513 <div class=
"paragraph">
514 <p>When more than one pattern matches the path, a later line
515 overrides an earlier line. This overriding is done per
518 <div class=
"paragraph">
519 <p>The rules by which the pattern matches paths are the same as in
520 .
<code>gitignore
</code> files (see
<a href=
"gitignore.html">gitignore(
5)
</a>), with a few exceptions:
</p>
525 <p>negative patterns are forbidden
</p>
528 <p>patterns that match a directory do not recursively match paths
529 inside that directory (so using the trailing-slash
<code>path/
</code> syntax is
530 pointless in an attributes file; use
<code>path/
</code>** instead)
</p>
534 <div class=
"paragraph">
535 <p>When deciding what attributes are assigned to a path, Git
536 consults
<code>$GIT_DIR/info/attributes
</code> file (which has the highest
537 precedence), .
<code>gitattributes
</code> file in the same directory as the
538 path in question, and its parent directories up to the toplevel of the
539 work tree (the further the directory that contains .
<code>gitattributes
</code>
540 is from the path in question, the lower its precedence). Finally
541 global and system-wide files are considered (they have the lowest
544 <div class=
"paragraph">
545 <p>When the .
<code>gitattributes
</code> file is missing from the work tree, the
546 path in the index is used as a fall-back. During checkout process,
547 .
<code>gitattributes
</code> in the index is used and then the file in the
548 working tree is used as a fall-back.
</p>
550 <div class=
"paragraph">
551 <p>If you wish to affect only a single repository (i.e., to assign
552 attributes to files that are particular to
553 one user
’s workflow for that repository), then
554 attributes should be placed in the
<code>$GIT_DIR/info/attributes
</code> file.
555 Attributes which should be version-controlled and distributed to other
556 repositories (i.e., attributes of interest to all users) should go into
557 .
<code>gitattributes
</code> files. Attributes that should affect all repositories
558 for a single user should be placed in a file specified by the
559 <code>core.attributesFile
</code> configuration option (see
<a href=
"git-config.html">git-config(
1)
</a>).
560 Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME
561 is either not set or empty, $HOME/.config/git/attributes is used instead.
562 Attributes for all users on a system should be placed in the
563 <code>$
</code>(
<code>prefix
</code>)
<code>/etc/gitattributes
</code> file.
</p>
565 <div class=
"paragraph">
566 <p>Sometimes you would need to override a setting of an attribute
567 for a path to
<code>Unspecified
</code> state. This can be done by listing
568 the name of the attribute prefixed with an exclamation point !.
</p>
573 <h2 id=
"_reserved_builtin_attributes">RESERVED BUILTIN_* ATTRIBUTES
</h2>
574 <div class=
"sectionbody">
575 <div class=
"paragraph">
576 <p>builtin_* is a reserved namespace for builtin attribute values. Any
577 user defined attributes under this namespace will be ignored and
578 trigger a warning.
</p>
581 <h3 id=
"_builtin_objectmode"><code>builtin_objectmode
</code></h3>
582 <div class=
"paragraph">
583 <p>This attribute is for filtering files by their file bit modes (
40000,
584 120000,
160000,
100755,
100644). e.g.
<em>:(attr:builtin_objectmode=
160000)
</em>.
585 You may also check these values with
<code>git
</code> <code>check-attr
</code> <code>builtin_objectmode
</code> <code>--
</code> <em><file
></em>.
586 If the object is not in the index
<code>git
</code> <code>check-attr
</code> <code>--cached
</code> will return unspecified.
</p>
592 <h2 id=
"_effects">EFFECTS
</h2>
593 <div class=
"sectionbody">
594 <div class=
"paragraph">
595 <p>Certain operations by Git can be influenced by assigning
596 particular attributes to a path. Currently, the following
597 operations are attributes-aware.
</p>
600 <h3 id=
"_checking_out_and_checking_in">Checking-out and checking-in
</h3>
601 <div class=
"paragraph">
602 <p>These attributes affect how the contents stored in the
603 repository are copied to the working tree files when commands
604 such as
<em>git switch
</em>,
<em>git checkout
</em> and
<em>git merge
</em> run.
606 Git stores the contents you prepare in the working tree in the
607 repository upon
<em>git add
</em> and
<em>git commit
</em>.
</p>
610 <h4 id=
"_text"><code>text
</code></h4>
611 <div class=
"paragraph">
612 <p>This attribute marks the path as a text file, which enables end-of-line
613 conversion: When a matching file is added to the index, the file
’s line
614 endings are normalized to LF in the index. Conversely, when the file is
615 copied from the index to the working directory, its line endings may be
616 converted from LF to CRLF depending on the
<code>eol
</code> attribute, the Git
617 config, and the platform (see explanation of
<code>eol
</code> below).
</p>
621 <dt class=
"hdlist1">Set
</dt>
623 <p>Setting the
<code>text
</code> attribute on a path enables end-of-line
624 conversion on checkin and checkout as described above. Line endings
625 are normalized to LF in the index every time the file is checked in,
626 even if the file was previously added to Git with CRLF line endings.
</p>
628 <dt class=
"hdlist1">Unset
</dt>
630 <p>Unsetting the
<code>text
</code> attribute on a path tells Git not to
631 attempt any end-of-line conversion upon checkin or checkout.
</p>
633 <dt class=
"hdlist1">Set to string value
"auto"</dt>
635 <p>When
<code>text
</code> is set to
"auto", Git decides by itself whether the file
636 is text or binary. If it is text and the file was not already in
637 Git with CRLF endings, line endings are converted on checkin and
638 checkout as described above. Otherwise, no conversion is done on
639 checkin or checkout.
</p>
641 <dt class=
"hdlist1">Unspecified
</dt>
643 <p>If the
<code>text
</code> attribute is unspecified, Git uses the
644 <code>core.autocrlf
</code> configuration variable to determine if the
645 file should be converted.
</p>
649 <div class=
"paragraph">
650 <p>Any other value causes Git to act as if
<code>text
</code> has been left
655 <h4 id=
"_eol"><code>eol
</code></h4>
656 <div class=
"paragraph">
657 <p>This attribute marks a path to use a specific line-ending style in the
658 working tree when it is checked out. It has effect only if
<code>text
</code> or
659 <code>text=auto
</code> is set (see above), but specifying
<code>eol
</code> automatically sets
660 <code>text
</code> if
<code>text
</code> was left unspecified.
</p>
664 <dt class=
"hdlist1">Set to string value
"crlf"</dt>
666 <p>This setting converts the file
’s line endings in the working
667 directory to CRLF when the file is checked out.
</p>
669 <dt class=
"hdlist1">Set to string value
"lf"</dt>
671 <p>This setting uses the same line endings in the working directory as
672 in the index when the file is checked out.
</p>
674 <dt class=
"hdlist1">Unspecified
</dt>
676 <p>If the
<code>eol
</code> attribute is unspecified for a file, its line endings
677 in the working directory are determined by the
<code>core.autocrlf
</code> or
678 <code>core.eol
</code> configuration variable (see the definitions of those
679 options in
<a href=
"git-config.html">git-config(
1)
</a>). If
<code>text
</code> is set but neither of
680 those variables is, the default is
<code>eol=crlf
</code> on Windows and
681 <code>eol=lf
</code> on all other platforms.
</p>
687 <h4 id=
"_backwards_compatibility_with_crlf_attribute">Backwards compatibility with
<code>crlf
</code> attribute
</h4>
688 <div class=
"paragraph">
689 <p>For backwards compatibility, the
<code>crlf
</code> attribute is interpreted as
692 <div class=
"listingblock">
693 <div class=
"content">
696 crlf=input eol=lf
</pre>
701 <h4 id=
"_end_of_line_conversion">End-of-line conversion
</h4>
702 <div class=
"paragraph">
703 <p>While Git normally leaves file contents alone, it can be configured to
704 normalize line endings to LF in the repository and, optionally, to
705 convert them to CRLF when files are checked out.
</p>
707 <div class=
"paragraph">
708 <p>If you simply want to have CRLF line endings in your working directory
709 regardless of the repository you are working with, you can set the
710 config variable
"core.autocrlf" without using any attributes.
</p>
712 <div class=
"listingblock">
713 <div class=
"content">
715 autocrlf = true
</pre>
718 <div class=
"paragraph">
719 <p>This does not force normalization of text files, but does ensure
720 that text files that you introduce to the repository have their line
721 endings normalized to LF when they are added, and that files that are
722 already normalized in the repository stay normalized.
</p>
724 <div class=
"paragraph">
725 <p>If you want to ensure that text files that any contributor introduces to
726 the repository have their line endings normalized, you can set the
727 <code>text
</code> attribute to
"auto" for
<em>all
</em> files.
</p>
729 <div class=
"listingblock">
730 <div class=
"content">
731 <pre>* text=auto
</pre>
734 <div class=
"paragraph">
735 <p>The attributes allow a fine-grained control, how the line endings
737 Here is an example that will make Git normalize .txt, .vcproj and .sh
738 files, ensure that .vcproj files have CRLF and .sh files have LF in
739 the working directory, and prevent .jpg files from being normalized
740 regardless of their content.
</p>
742 <div class=
"listingblock">
743 <div class=
"content">
746 *.vcproj text eol=crlf
751 <div class=
"admonitionblock note">
755 <div class=
"title">Note
</div>
758 When
<code>text=auto
</code> conversion is enabled in a cross-platform
759 project using push and pull to a central repository the text files
760 containing CRLFs should be normalized.
765 <div class=
"paragraph">
766 <p>From a clean working directory:
</p>
768 <div class=
"listingblock">
769 <div class=
"content">
770 <pre>$ echo
"* text=auto" >.gitattributes
771 $ git add --renormalize .
772 $ git status # Show files that will be normalized
773 $ git commit -m
"Introduce end-of-line normalization"</pre>
776 <div class=
"paragraph">
777 <p>If any files that should not be normalized show up in
<em>git status
</em>,
778 unset their
<code>text
</code> attribute before running
<em>git add -u
</em>.
</p>
780 <div class=
"listingblock">
781 <div class=
"content">
782 <pre>manual.pdf -text
</pre>
785 <div class=
"paragraph">
786 <p>Conversely, text files that Git does not detect can have normalization
787 enabled manually.
</p>
789 <div class=
"listingblock">
790 <div class=
"content">
791 <pre>weirdchars.txt text
</pre>
794 <div class=
"paragraph">
795 <p>If
<code>core.safecrlf
</code> is set to
"true" or
"warn", Git verifies if
796 the conversion is reversible for the current setting of
797 <code>core.autocrlf
</code>. For
"true", Git rejects irreversible
798 conversions; for
"warn", Git only prints a warning but accepts
799 an irreversible conversion. The safety triggers to prevent such
800 a conversion done to the files in the work tree, but there are a
801 few exceptions. Even though
…​</p>
806 <p><em>git add
</em> itself does not touch the files in the work tree, the
807 next checkout would, so the safety triggers;
</p>
810 <p><em>git apply
</em> to update a text file with a patch does touch the files
811 in the work tree, but the operation is about text files and CRLF
812 conversion is about fixing the line ending inconsistencies, so the
813 safety does not trigger;
</p>
816 <p><em>git diff
</em> itself does not touch the files in the work tree, it is
817 often run to inspect the changes you intend to next
<em>git add
</em>. To
818 catch potential problems early, safety triggers.
</p>
824 <h4 id=
"_working_tree_encoding"><code>working-tree-encoding
</code></h4>
825 <div class=
"paragraph">
826 <p>Git recognizes files encoded in ASCII or one of its supersets (e.g.
827 UTF-
8, ISO-
8859-
1,
…​) as text files. Files encoded in certain other
828 encodings (e.g. UTF-
16) are interpreted as binary and consequently
829 built-in Git text processing tools (e.g.
<em>git diff
</em>) as well as most Git
830 web front ends do not visualize the contents of these files by default.
</p>
832 <div class=
"paragraph">
833 <p>In these cases you can tell Git the encoding of a file in the working
834 directory with the
<code>working-tree-encoding
</code> attribute. If a file with this
835 attribute is added to Git, then Git re-encodes the content from the
836 specified encoding to UTF-
8. Finally, Git stores the UTF-
8 encoded
837 content in its internal data structure (called
"the index"). On checkout
838 the content is re-encoded back to the specified encoding.
</p>
840 <div class=
"paragraph">
841 <p>Please note that using the
<code>working-tree-encoding
</code> attribute may have a
842 number of pitfalls:
</p>
847 <p>Alternative Git implementations (e.g. JGit or libgit2) and older Git
848 versions (as of March
2018) do not support the
<code>working-tree-encoding
</code>
849 attribute. If you decide to use the
<code>working-tree-encoding
</code> attribute
850 in your repository, then it is strongly recommended to ensure that all
851 clients working with the repository support it.
</p>
852 <div class=
"paragraph">
853 <p>For example, Microsoft Visual Studio resources files (*.
<code>rc
</code>) or
854 PowerShell script files (*.
<code>ps1
</code>) are sometimes encoded in UTF-
16.
855 If you declare *.
<code>ps1
</code> as files as UTF-
16 and you add
<code>foo.ps1
</code> with
856 a
<code>working-tree-encoding
</code> enabled Git client, then
<code>foo.ps1
</code> will be
857 stored as UTF-
8 internally. A client without
<code>working-tree-encoding
</code>
858 support will checkout
<code>foo.ps1
</code> as UTF-
8 encoded file. This will
859 typically cause trouble for the users of this file.
</p>
861 <div class=
"paragraph">
862 <p>If a Git client that does not support the
<code>working-tree-encoding
</code>
863 attribute adds a new file
<code>bar.ps1
</code>, then
<code>bar.ps1
</code> will be
864 stored
"as-is" internally (in this example probably as UTF-
16).
865 A client with
<code>working-tree-encoding
</code> support will interpret the
866 internal contents as UTF-
8 and try to convert it to UTF-
16 on checkout.
867 That operation will fail and cause an error.
</p>
871 <p>Reencoding content to non-UTF encodings can cause errors as the
872 conversion might not be UTF-
8 round trip safe. If you suspect your
873 encoding to not be round trip safe, then add it to
874 <code>core.checkRoundtripEncoding
</code> to make Git check the round trip
875 encoding (see
<a href=
"git-config.html">git-config(
1)
</a>). SHIFT-JIS (Japanese character
876 set) is known to have round trip issues with UTF-
8 and is checked by
880 <p>Reencoding content requires resources that might slow down certain
881 Git operations (e.g
<em>git checkout
</em> or
<em>git add
</em>).
</p>
885 <div class=
"paragraph">
886 <p>Use the
<code>working-tree-encoding
</code> attribute only if you cannot store a file
887 in UTF-
8 encoding and if you want Git to be able to process the content
890 <div class=
"paragraph">
891 <p>As an example, use the following attributes if your
<em>*.ps1
</em> files are
892 UTF-
16 encoded with byte order mark (BOM) and you want Git to perform
893 automatic line ending conversion based on your platform.
</p>
895 <div class=
"listingblock">
896 <div class=
"content">
897 <pre>*.ps1 text working-tree-encoding=UTF-
16</pre>
900 <div class=
"paragraph">
901 <p>Use the following attributes if your
<em>*.ps1
</em> files are UTF-
16 little
902 endian encoded without BOM and you want Git to use Windows line endings
903 in the working directory (use
<code>UTF-
16LE-BOM
</code> instead of
<code>UTF-
16LE
</code> if
904 you want UTF-
16 little endian with BOM).
905 Please note, it is highly recommended to
906 explicitly define the line endings with
<code>eol
</code> if the
<code>working-tree-encoding
</code>
907 attribute is used to avoid ambiguity.
</p>
909 <div class=
"listingblock">
910 <div class=
"content">
911 <pre>*.ps1 text working-tree-encoding=UTF-
16LE eol=crlf
</pre>
914 <div class=
"paragraph">
915 <p>You can get a list of all available encodings on your platform with the
916 following command:
</p>
918 <div class=
"listingblock">
919 <div class=
"content">
920 <pre>iconv --list
</pre>
923 <div class=
"paragraph">
924 <p>If you do not know the encoding of a file, then you can use the
<code>file
</code>
925 command to guess the encoding:
</p>
927 <div class=
"listingblock">
928 <div class=
"content">
929 <pre>file foo.ps1
</pre>
934 <h4 id=
"_ident"><code>ident
</code></h4>
935 <div class=
"paragraph">
936 <p>When the attribute
<code>ident
</code> is set for a path, Git replaces
937 <code>$Id$
</code> in the blob object with
<code>$Id:
</code>, followed by the
938 40-character hexadecimal blob object name, followed by a dollar
939 sign
<code>$
</code> upon checkout. Any byte sequence that begins with
940 <code>$Id:
</code> and ends with
<code>$
</code> in the worktree file is replaced
941 with
<code>$Id$
</code> upon check-in.
</p>
945 <h4 id=
"_filter"><code>filter
</code></h4>
946 <div class=
"paragraph">
947 <p>A
<code>filter
</code> attribute can be set to a string value that names a
948 filter driver specified in the configuration.
</p>
950 <div class=
"paragraph">
951 <p>A filter driver consists of a
<code>clean
</code> command and a
<code>smudge
</code>
952 command, either of which can be left unspecified. Upon
953 checkout, when the
<code>smudge
</code> command is specified, the command is
954 fed the blob object from its standard input, and its standard
955 output is used to update the worktree file. Similarly, the
956 <code>clean
</code> command is used to convert the contents of worktree file
957 upon checkin. By default these commands process only a single
958 blob and terminate. If a long running
<code>process
</code> filter is used
959 in place of
<code>clean
</code> and/or
<code>smudge
</code> filters, then Git can process
960 all blobs with a single filter command invocation for the entire
961 life of a single Git command, for example
<code>git
</code> <code>add
</code> <code>--all
</code>. If a
962 long running
<code>process
</code> filter is configured then it always takes
963 precedence over a configured single blob filter. See section
964 below for the description of the protocol used to communicate with
965 a
<code>process
</code> filter.
</p>
967 <div class=
"paragraph">
968 <p>One use of the content filtering is to massage the content into a shape
969 that is more convenient for the platform, filesystem, and the user to use.
970 For this mode of operation, the key phrase here is
"more convenient" and
971 not
"turning something unusable into usable". In other words, the intent
972 is that if someone unsets the filter driver definition, or does not have
973 the appropriate filter program, the project should still be usable.
</p>
975 <div class=
"paragraph">
976 <p>Another use of the content filtering is to store the content that cannot
977 be directly used in the repository (e.g. a UUID that refers to the true
978 content stored outside Git, or an encrypted content) and turn it into a
979 usable form upon checkout (e.g. download the external content, or decrypt
980 the encrypted content).
</p>
982 <div class=
"paragraph">
983 <p>These two filters behave differently, and by default, a filter is taken as
984 the former, massaging the contents into more convenient shape. A missing
985 filter driver definition in the config, or a filter driver that exits with
986 a non-zero status, is not an error but makes the filter a no-op passthru.
</p>
988 <div class=
"paragraph">
989 <p>You can declare that a filter turns a content that by itself is unusable
990 into a usable content by setting the filter.
<driver
>.required configuration
991 variable to
<code>true
</code>.
</p>
993 <div class=
"paragraph">
994 <p>Note: Whenever the clean filter is changed, the repo should be renormalized:
995 $ git add --renormalize .
</p>
997 <div class=
"paragraph">
998 <p>For example, in .gitattributes, you would assign the
<code>filter
</code>
999 attribute for paths.
</p>
1001 <div class=
"listingblock">
1002 <div class=
"content">
1003 <pre>*.c filter=indent
</pre>
1006 <div class=
"paragraph">
1007 <p>Then you would define a
"filter.indent.clean" and
"filter.indent.smudge"
1008 configuration in your .git/config to specify a pair of commands to
1009 modify the contents of C programs when the source files are checked
1010 in (
"clean" is run) and checked out (no change is made because the
1011 command is
"cat").
</p>
1013 <div class=
"listingblock">
1014 <div class=
"content">
1015 <pre>[filter
"indent"]
1020 <div class=
"paragraph">
1021 <p>For best results,
<code>clean
</code> should not alter its output further if it is
1022 run twice (
"clean→clean" should be equivalent to
"clean"), and
1023 multiple
<code>smudge
</code> commands should not alter
<code>clean
</code>'s output
1024 (
"smudge→smudge→clean" should be equivalent to
"clean"). See the
1025 section on merging below.
</p>
1027 <div class=
"paragraph">
1028 <p>The
"indent" filter is well-behaved in this regard: it will not modify
1029 input that is already correctly indented. In this case, the lack of a
1030 smudge filter means that the clean filter
<em>must
</em> accept its own output
1031 without modifying it.
</p>
1033 <div class=
"paragraph">
1034 <p>If a filter
<em>must
</em> succeed in order to make the stored contents usable,
1035 you can declare that the filter is
<code>required
</code>, in the configuration:
</p>
1037 <div class=
"listingblock">
1038 <div class=
"content">
1039 <pre>[filter
"crypt"]
1040 clean = openssl enc ...
1041 smudge = openssl enc -d ...
1045 <div class=
"paragraph">
1046 <p>Sequence
"%f" on the filter command line is replaced with the name of
1047 the file the filter is working on. A filter might use this in keyword
1048 substitution. For example:
</p>
1050 <div class=
"listingblock">
1051 <div class=
"content">
1053 clean = git-p4-filter --clean %f
1054 smudge = git-p4-filter --smudge %f
</pre>
1057 <div class=
"paragraph">
1058 <p>Note that
"%f" is the name of the path that is being worked on. Depending
1059 on the version that is being filtered, the corresponding file on disk may
1060 not exist, or may have different contents. So, smudge and clean commands
1061 should not try to access the file on disk, but only act as filters on the
1062 content provided to them on standard input.
</p>
1066 <h4 id=
"_long_running_filter_process">Long Running Filter Process
</h4>
1067 <div class=
"paragraph">
1068 <p>If the filter command (a string value) is defined via
1069 <code>filter.
</code><em><driver
></em><code>.process
</code> then Git can process all blobs with a
1070 single filter invocation for the entire life of a single Git
1071 command. This is achieved by using the long-running process protocol
1072 (described in technical/long-running-process-protocol.txt).
</p>
1074 <div class=
"paragraph">
1075 <p>When Git encounters the first file that needs to be cleaned or smudged,
1076 it starts the filter and performs the handshake. In the handshake, the
1077 welcome message sent by Git is
"git-filter-client", only version
2 is
1078 supported, and the supported capabilities are
"clean",
"smudge", and
1081 <div class=
"paragraph">
1082 <p>Afterwards Git sends a list of
"key=value" pairs terminated with
1083 a flush packet. The list will contain at least the filter command
1084 (based on the supported capabilities) and the pathname of the file
1085 to filter relative to the repository root. Right after the flush packet
1086 Git sends the content split in zero or more pkt-line packets and a
1087 flush packet to terminate content. Please note, that the filter
1088 must not send any response before it received the content and the
1089 final flush packet. Also note that the
"value" of a
"key=value" pair
1090 can contain the
"=" character whereas the key would never contain
1093 <div class=
"listingblock">
1094 <div class=
"content">
1095 <pre>packet: git
> command=smudge
1096 packet: git
> pathname=path/testfile.dat
1097 packet: git
> 0000
1098 packet: git
> CONTENT
1099 packet: git
> 0000</pre>
1102 <div class=
"paragraph">
1103 <p>The filter is expected to respond with a list of
"key=value" pairs
1104 terminated with a flush packet. If the filter does not experience
1105 problems then the list must contain a
"success" status. Right after
1106 these packets the filter is expected to send the content in zero
1107 or more pkt-line packets and a flush packet at the end. Finally, a
1108 second list of
"key=value" pairs terminated with a flush packet
1109 is expected. The filter can change the status in the second list
1110 or keep the status as is with an empty list. Please note that the
1111 empty list must be terminated with a flush packet regardless.
</p>
1113 <div class=
"listingblock">
1114 <div class=
"content">
1115 <pre>packet: git
< status=success
1116 packet: git
< 0000
1117 packet: git
< SMUDGED_CONTENT
1118 packet: git
< 0000
1119 packet: git
< 0000 # empty list, keep
"status=success" unchanged!
</pre>
1122 <div class=
"paragraph">
1123 <p>If the result content is empty then the filter is expected to respond
1124 with a
"success" status and a flush packet to signal the empty content.
</p>
1126 <div class=
"listingblock">
1127 <div class=
"content">
1128 <pre>packet: git
< status=success
1129 packet: git
< 0000
1130 packet: git
< 0000 # empty content!
1131 packet: git
< 0000 # empty list, keep
"status=success" unchanged!
</pre>
1134 <div class=
"paragraph">
1135 <p>In case the filter cannot or does not want to process the content,
1136 it is expected to respond with an
"error" status.
</p>
1138 <div class=
"listingblock">
1139 <div class=
"content">
1140 <pre>packet: git
< status=error
1141 packet: git
< 0000</pre>
1144 <div class=
"paragraph">
1145 <p>If the filter experiences an error during processing, then it can
1146 send the status
"error" after the content was (partially or
1147 completely) sent.
</p>
1149 <div class=
"listingblock">
1150 <div class=
"content">
1151 <pre>packet: git
< status=success
1152 packet: git
< 0000
1153 packet: git
< HALF_WRITTEN_ERRONEOUS_CONTENT
1154 packet: git
< 0000
1155 packet: git
< status=error
1156 packet: git
< 0000</pre>
1159 <div class=
"paragraph">
1160 <p>In case the filter cannot or does not want to process the content
1161 as well as any future content for the lifetime of the Git process,
1162 then it is expected to respond with an
"abort" status at any point
1163 in the protocol.
</p>
1165 <div class=
"listingblock">
1166 <div class=
"content">
1167 <pre>packet: git
< status=abort
1168 packet: git
< 0000</pre>
1171 <div class=
"paragraph">
1172 <p>Git neither stops nor restarts the filter process in case the
1173 "error"/
"abort" status is set. However, Git sets its exit code
1174 according to the
<code>filter.
</code><em><driver
></em><code>.required
</code> flag, mimicking the
1175 behavior of the
<code>filter.
</code><em><driver
></em><code>.clean
</code> /
<code>filter.
</code><em><driver
></em><code>.smudge
</code>
1178 <div class=
"paragraph">
1179 <p>If the filter dies during the communication or does not adhere to
1180 the protocol then Git will stop the filter process and restart it
1181 with the next file that needs to be processed. Depending on the
1182 <code>filter.
</code><em><driver
></em><code>.required
</code> flag Git will interpret that as error.
</p>
1186 <h4 id=
"_delay">Delay
</h4>
1187 <div class=
"paragraph">
1188 <p>If the filter supports the
"delay" capability, then Git can send the
1189 flag
"can-delay" after the filter command and pathname. This flag
1190 denotes that the filter can delay filtering the current blob (e.g. to
1191 compensate network latencies) by responding with no content but with
1192 the status
"delayed" and a flush packet.
</p>
1194 <div class=
"listingblock">
1195 <div class=
"content">
1196 <pre>packet: git
> command=smudge
1197 packet: git
> pathname=path/testfile.dat
1198 packet: git
> can-delay=
1
1199 packet: git
> 0000
1200 packet: git
> CONTENT
1201 packet: git
> 0000
1202 packet: git
< status=delayed
1203 packet: git
< 0000</pre>
1206 <div class=
"paragraph">
1207 <p>If the filter supports the
"delay" capability then it must support the
1208 "list_available_blobs" command. If Git sends this command, then the
1209 filter is expected to return a list of pathnames representing blobs
1210 that have been delayed earlier and are now available.
1211 The list must be terminated with a flush packet followed
1212 by a
"success" status that is also terminated with a flush packet. If
1213 no blobs for the delayed paths are available, yet, then the filter is
1214 expected to block the response until at least one blob becomes
1215 available. The filter can tell Git that it has no more delayed blobs
1216 by sending an empty list. As soon as the filter responds with an empty
1217 list, Git stops asking. All blobs that Git has not received at this
1218 point are considered missing and will result in an error.
</p>
1220 <div class=
"listingblock">
1221 <div class=
"content">
1222 <pre>packet: git
> command=list_available_blobs
1223 packet: git
> 0000
1224 packet: git
< pathname=path/testfile.dat
1225 packet: git
< pathname=path/otherfile.dat
1226 packet: git
< 0000
1227 packet: git
< status=success
1228 packet: git
< 0000</pre>
1231 <div class=
"paragraph">
1232 <p>After Git received the pathnames, it will request the corresponding
1233 blobs again. These requests contain a pathname and an empty content
1234 section. The filter is expected to respond with the smudged content
1235 in the usual way as explained above.
</p>
1237 <div class=
"listingblock">
1238 <div class=
"content">
1239 <pre>packet: git
> command=smudge
1240 packet: git
> pathname=path/testfile.dat
1241 packet: git
> 0000
1242 packet: git
> 0000 # empty content!
1243 packet: git
< status=success
1244 packet: git
< 0000
1245 packet: git
< SMUDGED_CONTENT
1246 packet: git
< 0000
1247 packet: git
< 0000 # empty list, keep
"status=success" unchanged!
</pre>
1252 <h4 id=
"_example">Example
</h4>
1253 <div class=
"paragraph">
1254 <p>A long running filter demo implementation can be found in
1255 <code>contrib/long-running-filter/example.pl
</code> located in the Git
1256 core repository. If you develop your own long running filter
1257 process then the
<code>GIT_TRACE_PACKET
</code> environment variables can be
1258 very helpful for debugging (see
<a href=
"git.html">git(
1)
</a>).
</p>
1260 <div class=
"paragraph">
1261 <p>Please note that you cannot use an existing
<code>filter.
</code><em><driver
></em><code>.clean
</code>
1262 or
<code>filter.
</code><em><driver
></em><code>.smudge
</code> command with
<code>filter.
</code><em><driver
></em><code>.process
</code>
1263 because the former two use a different inter process communication
1264 protocol than the latter one.
</p>
1268 <h4 id=
"_interaction_between_checkincheckout_attributes">Interaction between checkin/checkout attributes
</h4>
1269 <div class=
"paragraph">
1270 <p>In the check-in codepath, the worktree file is first converted
1271 with
<code>filter
</code> driver (if specified and corresponding driver
1272 defined), then the result is processed with
<code>ident
</code> (if
1273 specified), and then finally with
<code>text
</code> (again, if specified
1274 and applicable).
</p>
1276 <div class=
"paragraph">
1277 <p>In the check-out codepath, the blob content is first converted
1278 with
<code>text
</code>, and then
<code>ident
</code> and fed to
<code>filter
</code>.
</p>
1282 <h4 id=
"_merging_branches_with_differing_checkincheckout_attributes">Merging branches with differing checkin/checkout attributes
</h4>
1283 <div class=
"paragraph">
1284 <p>If you have added attributes to a file that cause the canonical
1285 repository format for that file to change, such as adding a
1286 clean/smudge filter or text/eol/ident attributes, merging anything
1287 where the attribute is not in place would normally cause merge
1290 <div class=
"paragraph">
1291 <p>To prevent these unnecessary merge conflicts, Git can be told to run a
1292 virtual check-out and check-in of all three stages of a file when
1293 resolving a three-way merge by setting the
<code>merge.renormalize
</code>
1294 configuration variable. This prevents changes caused by check-in
1295 conversion from causing spurious merge conflicts when a converted file
1296 is merged with an unconverted file.
</p>
1298 <div class=
"paragraph">
1299 <p>As long as a
"smudge→clean" results in the same output as a
"clean"
1300 even on files that are already smudged, this strategy will
1301 automatically resolve all filter-related conflicts. Filters that do
1302 not act in this way may cause additional merge conflicts that must be
1303 resolved manually.
</p>
1308 <h3 id=
"_generating_diff_text">Generating diff text
</h3>
1310 <h4 id=
"_diff"><code>diff
</code></h4>
1311 <div class=
"paragraph">
1312 <p>The attribute
<code>diff
</code> affects how Git generates diffs for particular
1313 files. It can tell Git whether to generate a textual patch for the path
1314 or to treat the path as a binary file. It can also affect what line is
1315 shown on the hunk header
<code>@@
</code> <code>-k,l
</code> <code>+n,m
</code> <code>@@
</code> line, tell Git to use an
1316 external command to generate the diff, or ask Git to convert binary
1317 files to a text format before generating the diff.
</p>
1321 <dt class=
"hdlist1">Set
</dt>
1323 <p>A path to which the
<code>diff
</code> attribute is set is treated
1324 as text, even when they contain byte values that
1325 normally never appear in text files, such as NUL.
</p>
1327 <dt class=
"hdlist1">Unset
</dt>
1329 <p>A path to which the
<code>diff
</code> attribute is unset will
1330 generate
<code>Binary
</code> <code>files
</code> <code>differ
</code> (or a binary patch, if
1331 binary patches are enabled).
</p>
1333 <dt class=
"hdlist1">Unspecified
</dt>
1335 <p>A path to which the
<code>diff
</code> attribute is unspecified
1336 first gets its contents inspected, and if it looks like
1337 text and is smaller than core.bigFileThreshold, it is treated
1338 as text. Otherwise it would generate
<code>Binary
</code> <code>files
</code> <code>differ
</code>.
</p>
1340 <dt class=
"hdlist1">String
</dt>
1342 <p>Diff is shown using the specified diff driver. Each driver may
1343 specify one or more options, as described in the following
1344 section. The options for the diff driver
"foo" are defined
1345 by the configuration variables in the
"diff.foo" section of the
1346 Git config file.
</p>
1352 <h4 id=
"_defining_an_external_diff_driver">Defining an external diff driver
</h4>
1353 <div class=
"paragraph">
1354 <p>The definition of a diff driver is done in
<code>gitconfig
</code>, not
1355 <code>gitattributes
</code> file, so strictly speaking this manual page is a
1356 wrong place to talk about it. However
…​</p>
1358 <div class=
"paragraph">
1359 <p>To define an external diff driver
<code>jcdiff
</code>, add a section to your
1360 <code>$GIT_DIR/config
</code> file (or
<code>$HOME/.gitconfig
</code> file) like this:
</p>
1362 <div class=
"listingblock">
1363 <div class=
"content">
1364 <pre>[diff
"jcdiff"]
1365 command = j-c-diff
</pre>
1368 <div class=
"paragraph">
1369 <p>When Git needs to show you a diff for the path with
<code>diff
</code>
1370 attribute set to
<code>jcdiff
</code>, it calls the command you specified
1371 with the above configuration, i.e.
<code>j-c-diff
</code>, with
7
1372 parameters, just like
<code>GIT_EXTERNAL_DIFF
</code> program is called.
1373 See
<a href=
"git.html">git(
1)
</a> for details.
</p>
1375 <div class=
"paragraph">
1376 <p>If the program is able to ignore certain changes (similar to
1377 <code>git
</code> <code>diff
</code> <code>--ignore-space-change
</code>), then also set the option
1378 <code>trustExitCode
</code> to true. It is then expected to return exit code
1 if
1379 it finds significant changes and
0 if it doesn
’t.
</p>
1383 <h4 id=
"_setting_the_internal_diff_algorithm">Setting the internal diff algorithm
</h4>
1384 <div class=
"paragraph">
1385 <p>The diff algorithm can be set through the
<code>diff.algorithm
</code> config key, but
1386 sometimes it may be helpful to set the diff algorithm per path. For example,
1387 one may want to use the
<code>minimal
</code> diff algorithm for .json files, and the
1388 <code>histogram
</code> for .c files, and so on without having to pass in the algorithm
1389 through the command line each time.
</p>
1391 <div class=
"paragraph">
1392 <p>First, in .
<code>gitattributes
</code>, assign the
<code>diff
</code> attribute for paths.
</p>
1394 <div class=
"listingblock">
1395 <div class=
"content">
1396 <pre>*.json diff=
<name
></pre>
1399 <div class=
"paragraph">
1400 <p>Then, define a
"diff.<name>.algorithm" configuration to specify the diff
1401 algorithm, choosing from
<code>myers
</code>,
<code>patience
</code>,
<code>minimal
</code>, or
<code>histogram
</code>.
</p>
1403 <div class=
"listingblock">
1404 <div class=
"content">
1405 <pre>[diff
"<name>"]
1406 algorithm = histogram
</pre>
1409 <div class=
"paragraph">
1410 <p>This diff algorithm applies to user facing diff output like git-diff(
1),
1411 git-show(
1) and is used for the
<code>--stat
</code> output as well. The merge machinery
1412 will not use the diff algorithm set through this method.
</p>
1414 <div class=
"admonitionblock note">
1418 <div class=
"title">Note
</div>
1420 <td class=
"content">
1421 If
<code>diff.
</code><em><name
></em><code>.command
</code> is defined for path with the
1422 <code>diff=
</code><em><name
></em> attribute, it is executed as an external diff driver
1423 (see above), and adding
<code>diff.
</code><em><name
></em><code>.algorithm
</code> has no effect, as the
1424 algorithm is not passed to the external diff driver.
1431 <h4 id=
"_defining_a_custom_hunk_header">Defining a custom hunk-header
</h4>
1432 <div class=
"paragraph">
1433 <p>Each group of changes (called a
"hunk") in the textual diff output
1434 is prefixed with a line of the form:
</p>
1436 <div class=
"literalblock">
1437 <div class=
"content">
1438 <pre>@@ -k,l +n,m @@ TEXT
</pre>
1441 <div class=
"paragraph">
1442 <p>This is called a
<em>hunk header
</em>. The
"TEXT" portion is by default a line
1443 that begins with an alphabet, an underscore or a dollar sign; this
1444 matches what GNU
<em>diff -p
</em> output uses. This default selection however
1445 is not suited for some contents, and you can use a customized pattern
1446 to make a selection.
</p>
1448 <div class=
"paragraph">
1449 <p>First, in .gitattributes, you would assign the
<code>diff
</code> attribute
1452 <div class=
"listingblock">
1453 <div class=
"content">
1454 <pre>*.tex diff=tex
</pre>
1457 <div class=
"paragraph">
1458 <p>Then, you would define a
"diff.tex.xfuncname" configuration to
1459 specify a regular expression that matches a line that you would
1460 want to appear as the hunk header
"TEXT". Add a section to your
1461 <code>$GIT_DIR/config
</code> file (or
<code>$HOME/.gitconfig
</code> file) like this:
</p>
1463 <div class=
"listingblock">
1464 <div class=
"content">
1466 xfuncname =
"^(\\\\(sub)*section\\{.*)$"</pre>
1469 <div class=
"paragraph">
1470 <p>Note. A single level of backslashes are eaten by the
1471 configuration file parser, so you would need to double the
1472 backslashes; the pattern above picks a line that begins with a
1473 backslash, and zero or more occurrences of
<code>sub
</code> followed by
1474 <code>section
</code> followed by open brace, to the end of line.
</p>
1476 <div class=
"paragraph">
1477 <p>There are a few built-in patterns to make this easier, and
<code>tex
</code>
1478 is one of them, so you do not have to write the above in your
1479 configuration file (you still need to enable this with the
1480 attribute mechanism, via .
<code>gitattributes
</code>). The following built in
1481 patterns are available:
</p>
1486 <p><code>ada
</code> suitable for source code in the Ada language.
</p>
1489 <p><code>bash
</code> suitable for source code in the Bourne-Again SHell language.
1490 Covers a superset of POSIX shell function definitions.
</p>
1493 <p><code>bibtex
</code> suitable for files with BibTeX coded references.
</p>
1496 <p><code>cpp
</code> suitable for source code in the C and C++ languages.
</p>
1499 <p><code>csharp
</code> suitable for source code in the C# language.
</p>
1502 <p><code>css
</code> suitable for cascading style sheets.
</p>
1505 <p><code>dts
</code> suitable for devicetree (DTS) files.
</p>
1508 <p><code>elixir
</code> suitable for source code in the Elixir language.
</p>
1511 <p><code>fortran
</code> suitable for source code in the Fortran language.
</p>
1514 <p><code>fountain
</code> suitable for Fountain documents.
</p>
1517 <p><code>golang
</code> suitable for source code in the Go language.
</p>
1520 <p><code>html
</code> suitable for HTML/XHTML documents.
</p>
1523 <p><code>java
</code> suitable for source code in the Java language.
</p>
1526 <p><code>kotlin
</code> suitable for source code in the Kotlin language.
</p>
1529 <p><code>markdown
</code> suitable for Markdown documents.
</p>
1532 <p><code>matlab
</code> suitable for source code in the MATLAB and Octave languages.
</p>
1535 <p><code>objc
</code> suitable for source code in the Objective-C language.
</p>
1538 <p><code>pascal
</code> suitable for source code in the Pascal/Delphi language.
</p>
1541 <p><code>perl
</code> suitable for source code in the Perl language.
</p>
1544 <p><code>php
</code> suitable for source code in the PHP language.
</p>
1547 <p><code>python
</code> suitable for source code in the Python language.
</p>
1550 <p><code>ruby
</code> suitable for source code in the Ruby language.
</p>
1553 <p><code>rust
</code> suitable for source code in the Rust language.
</p>
1556 <p><code>scheme
</code> suitable for source code in the Scheme language.
</p>
1559 <p><code>tex
</code> suitable for source code for LaTeX documents.
</p>
1565 <h4 id=
"_customizing_word_diff">Customizing word diff
</h4>
1566 <div class=
"paragraph">
1567 <p>You can customize the rules that
<code>git
</code> <code>diff
</code> <code>--word-diff
</code> uses to
1568 split words in a line, by specifying an appropriate regular expression
1569 in the
"diff.*.wordRegex" configuration variable. For example, in TeX
1570 a backslash followed by a sequence of letters forms a command, but
1571 several such commands can be run together without intervening
1572 whitespace. To separate them, use a regular expression in your
1573 <code>$GIT_DIR/config
</code> file (or
<code>$HOME/.gitconfig
</code> file) like this:
</p>
1575 <div class=
"listingblock">
1576 <div class=
"content">
1578 wordRegex =
"\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"</pre>
1581 <div class=
"paragraph">
1582 <p>A built-in pattern is provided for all languages listed in the
1583 previous section.
</p>
1587 <h4 id=
"_performing_text_diffs_of_binary_files">Performing text diffs of binary files
</h4>
1588 <div class=
"paragraph">
1589 <p>Sometimes it is desirable to see the diff of a text-converted
1590 version of some binary files. For example, a word processor
1591 document can be converted to an ASCII text representation, and
1592 the diff of the text shown. Even though this conversion loses
1593 some information, the resulting diff is useful for human
1594 viewing (but cannot be applied directly).
</p>
1596 <div class=
"paragraph">
1597 <p>The
<code>textconv
</code> config option is used to define a program for
1598 performing such a conversion. The program should take a single
1599 argument, the name of a file to convert, and produce the
1600 resulting text on stdout.
</p>
1602 <div class=
"paragraph">
1603 <p>For example, to show the diff of the exif information of a
1604 file instead of the binary information (assuming you have the
1605 exif tool installed), add the following section to your
1606 <code>$GIT_DIR/config
</code> file (or
<code>$HOME/.gitconfig
</code> file):
</p>
1608 <div class=
"listingblock">
1609 <div class=
"content">
1611 textconv = exif
</pre>
1614 <div class=
"admonitionblock note">
1618 <div class=
"title">Note
</div>
1620 <td class=
"content">
1621 The text conversion is generally a one-way conversion;
1622 in this example, we lose the actual image contents and focus
1623 just on the text data. This means that diffs generated by
1624 textconv are
<em>not
</em> suitable for applying. For this reason,
1625 only
<code>git
</code> <code>diff
</code> and the
<code>git
</code> <code>log
</code> family of commands (i.e.,
1626 log, whatchanged, show) will perform text conversion.
<code>git
</code>
1627 <code>format-patch
</code> will never generate this output. If you want to
1628 send somebody a text-converted diff of a binary file (e.g.,
1629 because it quickly conveys the changes you have made), you
1630 should generate it separately and send it as a comment
<em>in
1631 addition to
</em> the usual binary diff that you might send.
1636 <div class=
"paragraph">
1637 <p>Because text conversion can be slow, especially when doing a
1638 large number of them with
<code>git
</code> <code>log
</code> <code>-p
</code>, Git provides a mechanism
1639 to cache the output and use it in future diffs. To enable
1640 caching, set the
"cachetextconv" variable in your diff driver
’s
1641 config. For example:
</p>
1643 <div class=
"listingblock">
1644 <div class=
"content">
1647 cachetextconv = true
</pre>
1650 <div class=
"paragraph">
1651 <p>This will cache the result of running
"exif" on each blob
1652 indefinitely. If you change the textconv config variable for a
1653 diff driver, Git will automatically invalidate the cache entries
1654 and re-run the textconv filter. If you want to invalidate the
1655 cache manually (e.g., because your version of
"exif" was updated
1656 and now produces better output), you can remove the cache
1657 manually with
<code>git
</code> <code>update-ref
</code> <code>-d
</code> <code>refs/notes/textconv/jpg
</code> (where
1658 "jpg" is the name of the diff driver, as in the example above).
</p>
1662 <h4 id=
"_choosing_textconv_versus_external_diff">Choosing textconv versus external diff
</h4>
1663 <div class=
"paragraph">
1664 <p>If you want to show differences between binary or specially-formatted
1665 blobs in your repository, you can choose to use either an external diff
1666 command, or to use textconv to convert them to a diff-able text format.
1667 Which method you choose depends on your exact situation.
</p>
1669 <div class=
"paragraph">
1670 <p>The advantage of using an external diff command is flexibility. You are
1671 not bound to find line-oriented changes, nor is it necessary for the
1672 output to resemble unified diff. You are free to locate and report
1673 changes in the most appropriate way for your data format.
</p>
1675 <div class=
"paragraph">
1676 <p>A textconv, by comparison, is much more limiting. You provide a
1677 transformation of the data into a line-oriented text format, and Git
1678 uses its regular diff tools to generate the output. There are several
1679 advantages to choosing this method:
</p>
1681 <div class=
"olist arabic">
1684 <p>Ease of use. It is often much simpler to write a binary to text
1685 transformation than it is to perform your own diff. In many cases,
1686 existing programs can be used as textconv filters (e.g., exif,
1690 <p>Git diff features. By performing only the transformation step
1691 yourself, you can still utilize many of Git
’s diff features,
1692 including colorization, word-diff, and combined diffs for merges.
</p>
1695 <p>Caching. Textconv caching can speed up repeated diffs, such as those
1696 you might trigger by running
<code>git
</code> <code>log
</code> <code>-p
</code>.
</p>
1702 <h4 id=
"_marking_files_as_binary">Marking files as binary
</h4>
1703 <div class=
"paragraph">
1704 <p>Git usually guesses correctly whether a blob contains text or binary
1705 data by examining the beginning of the contents. However, sometimes you
1706 may want to override its decision, either because a blob contains binary
1707 data later in the file, or because the content, while technically
1708 composed of text characters, is opaque to a human reader. For example,
1709 many postscript files contain only ASCII characters, but produce noisy
1710 and meaningless diffs.
</p>
1712 <div class=
"paragraph">
1713 <p>The simplest way to mark a file as binary is to unset the diff
1714 attribute in the .
<code>gitattributes
</code> file:
</p>
1716 <div class=
"listingblock">
1717 <div class=
"content">
1718 <pre>*.ps -diff
</pre>
1721 <div class=
"paragraph">
1722 <p>This will cause Git to generate
<code>Binary
</code> <code>files
</code> <code>differ
</code> (or a binary
1723 patch, if binary patches are enabled) instead of a regular diff.
</p>
1725 <div class=
"paragraph">
1726 <p>However, one may also want to specify other diff driver attributes. For
1727 example, you might want to use
<code>textconv
</code> to convert postscript files to
1728 an ASCII representation for human viewing, but otherwise treat them as
1729 binary files. You cannot specify both
<code>-diff
</code> and
<code>diff=ps
</code> attributes.
1730 The solution is to use the
<code>diff.
</code>*.
<code>binary
</code> config option:
</p>
1732 <div class=
"listingblock">
1733 <div class=
"content">
1742 <h3 id=
"_performing_a_three_way_merge">Performing a three-way merge
</h3>
1744 <h4 id=
"_merge"><code>merge
</code></h4>
1745 <div class=
"paragraph">
1746 <p>The attribute
<code>merge
</code> affects how three versions of a file are
1747 merged when a file-level merge is necessary during
<code>git
</code> <code>merge
</code>,
1748 and other commands such as
<code>git
</code> <code>revert
</code> and
<code>git
</code> <code>cherry-pick
</code>.
</p>
1752 <dt class=
"hdlist1">Set
</dt>
1754 <p>Built-in
3-way merge driver is used to merge the
1755 contents in a way similar to
<em>merge
</em> command of
<code>RCS
</code>
1756 suite. This is suitable for ordinary text files.
</p>
1758 <dt class=
"hdlist1">Unset
</dt>
1760 <p>Take the version from the current branch as the
1761 tentative merge result, and declare that the merge has
1762 conflicts. This is suitable for binary files that do
1763 not have a well-defined merge semantics.
</p>
1765 <dt class=
"hdlist1">Unspecified
</dt>
1767 <p>By default, this uses the same built-in
3-way merge
1768 driver as is the case when the
<code>merge
</code> attribute is set.
1769 However, the
<code>merge.default
</code> configuration variable can name
1770 different merge driver to be used with paths for which the
1771 <code>merge
</code> attribute is unspecified.
</p>
1773 <dt class=
"hdlist1">String
</dt>
1775 <p>3-way merge is performed using the specified custom
1776 merge driver. The built-in
3-way merge driver can be
1777 explicitly specified by asking for
"text" driver; the
1778 built-in
"take the current branch" driver can be
1779 requested with
"binary".
</p>
1785 <h4 id=
"_built_in_merge_drivers">Built-in merge drivers
</h4>
1786 <div class=
"paragraph">
1787 <p>There are a few built-in low-level merge drivers defined that
1788 can be asked for via the
<code>merge
</code> attribute.
</p>
1792 <dt class=
"hdlist1">text
</dt>
1794 <p>Usual
3-way file level merge for text files. Conflicted
1795 regions are marked with conflict markers
<<<<<<<,
1796 <code>=======
</code> and
>>>>>>>. The version from your branch
1797 appears before the
<code>=======
</code> marker, and the version
1798 from the merged branch appears after the
<code>=======
</code>
1801 <dt class=
"hdlist1">binary
</dt>
1803 <p>Keep the version from your branch in the work tree, but
1804 leave the path in the conflicted state for the user to
1807 <dt class=
"hdlist1">union
</dt>
1809 <p>Run
3-way file level merge for text files, but take
1810 lines from both versions, instead of leaving conflict
1811 markers. This tends to leave the added lines in the
1812 resulting file in random order and the user should
1813 verify the result. Do not use this if you do not
1814 understand the implications.
</p>
1820 <h4 id=
"_defining_a_custom_merge_driver">Defining a custom merge driver
</h4>
1821 <div class=
"paragraph">
1822 <p>The definition of a merge driver is done in the .
<code>git/config
</code>
1823 file, not in the
<code>gitattributes
</code> file, so strictly speaking this
1824 manual page is a wrong place to talk about it. However
…​</p>
1826 <div class=
"paragraph">
1827 <p>To define a custom merge driver
<code>filfre
</code>, add a section to your
1828 <code>$GIT_DIR/config
</code> file (or
<code>$HOME/.gitconfig
</code> file) like this:
</p>
1830 <div class=
"listingblock">
1831 <div class=
"content">
1832 <pre>[merge
"filfre"]
1833 name = feel-free merge driver
1834 driver = filfre %O %A %B %L %P
1835 recursive = binary
</pre>
1838 <div class=
"paragraph">
1839 <p>The
<code>merge.
</code>*.
<code>name
</code> variable gives the driver a human-readable
1842 <div class=
"paragraph">
1843 <p>The
<code>merge.
</code>*.
<code>driver
</code> variable
’s value is used to construct a
1844 command to run to common ancestor
’s version (%O), current
1845 version (%A) and the other branches' version (%B). These
1846 three tokens are replaced with the names of temporary files that
1847 hold the contents of these versions when the command line is
1848 built. Additionally, %L will be replaced with the conflict marker
1849 size (see below).
</p>
1851 <div class=
"paragraph">
1852 <p>The merge driver is expected to leave the result of the merge in
1853 the file named with %A by overwriting it, and exit with zero
1854 status if it managed to merge them cleanly, or non-zero if there
1855 were conflicts. When the driver crashes (e.g. killed by SEGV),
1856 it is expected to exit with non-zero status that are higher than
1857 128, and in such a case, the merge results in a failure (which is
1858 different from producing a conflict).
</p>
1860 <div class=
"paragraph">
1861 <p>The
<code>merge.
</code>*.
<code>recursive
</code> variable specifies what other merge
1862 driver to use when the merge driver is called for an internal
1863 merge between common ancestors, when there are more than one.
1864 When left unspecified, the driver itself is used for both
1865 internal merge and the final merge.
</p>
1867 <div class=
"paragraph">
1868 <p>The merge driver can learn the pathname in which the merged result
1869 will be stored via placeholder %P. The conflict labels to be used
1870 for the common ancestor, local head and other head can be passed by
1871 using
<em>%S
</em>,
<em>%X
</em> and '%Y` respectively.
</p>
1875 <h4 id=
"_conflict_marker_size"><code>conflict-marker-size
</code></h4>
1876 <div class=
"paragraph">
1877 <p>This attribute controls the length of conflict markers left in
1878 the work tree file during a conflicted merge. Only a positive
1879 integer has a meaningful effect.
</p>
1881 <div class=
"paragraph">
1882 <p>For example, this line in .
<code>gitattributes
</code> can be used to tell the merge
1883 machinery to leave much longer (instead of the usual
7-character-long)
1884 conflict markers when merging the file
<code>Documentation/git-merge.txt
</code>
1885 results in a conflict.
</p>
1887 <div class=
"listingblock">
1888 <div class=
"content">
1889 <pre>Documentation/git-merge.txt conflict-marker-size=
32</pre>
1895 <h3 id=
"_checking_whitespace_errors">Checking whitespace errors
</h3>
1897 <h4 id=
"_whitespace"><code>whitespace
</code></h4>
1898 <div class=
"paragraph">
1899 <p>The
<code>core.whitespace
</code> configuration variable allows you to define what
1900 <em>diff
</em> and
<em>apply
</em> should consider whitespace errors for all paths in
1901 the project (See
<a href=
"git-config.html">git-config(
1)
</a>). This attribute gives you finer
1902 control per path.
</p>
1906 <dt class=
"hdlist1">Set
</dt>
1908 <p>Notice all types of potential whitespace errors known to Git.
1909 The tab width is taken from the value of the
<code>core.whitespace
</code>
1910 configuration variable.
</p>
1912 <dt class=
"hdlist1">Unset
</dt>
1914 <p>Do not notice anything as error.
</p>
1916 <dt class=
"hdlist1">Unspecified
</dt>
1918 <p>Use the value of the
<code>core.whitespace
</code> configuration variable to
1919 decide what to notice as error.
</p>
1921 <dt class=
"hdlist1">String
</dt>
1923 <p>Specify a comma separated list of common whitespace problems to
1924 notice in the same format as the
<code>core.whitespace
</code> configuration
1932 <h3 id=
"_creating_an_archive">Creating an archive
</h3>
1934 <h4 id=
"_export_ignore"><code>export-ignore
</code></h4>
1935 <div class=
"paragraph">
1936 <p>Files and directories with the attribute
<code>export-ignore
</code> won
’t be added to
1941 <h4 id=
"_export_subst"><code>export-subst
</code></h4>
1942 <div class=
"paragraph">
1943 <p>If the attribute
<code>export-subst
</code> is set for a file then Git will expand
1944 several placeholders when adding this file to an archive. The
1945 expansion depends on the availability of a commit ID, i.e., if
1946 <a href=
"git-archive.html">git-archive(
1)
</a> has been given a tree instead of a commit or a
1947 tag then no replacement will be done. The placeholders are the same
1948 as those for the option
<code>--pretty=format:
</code> of
<a href=
"git-log.html">git-log(
1)
</a>,
1949 except that they need to be wrapped like this:
<code>$Format:PLACEHOLDERS$
</code>
1950 in the file. E.g. the string
<code>$Format:
</code>%H$ will be replaced by the
1951 commit hash. However, only one %(
<code>describe
</code>) placeholder is expanded
1952 per archive to avoid denial-of-service attacks.
</p>
1957 <h3 id=
"_packing_objects">Packing objects
</h3>
1959 <h4 id=
"_delta"><code>delta
</code></h4>
1960 <div class=
"paragraph">
1961 <p>Delta compression will not be attempted for blobs for paths with the
1962 attribute
<code>delta
</code> set to false.
</p>
1967 <h3 id=
"_viewing_files_in_gui_tools">Viewing files in GUI tools
</h3>
1969 <h4 id=
"_encoding"><code>encoding
</code></h4>
1970 <div class=
"paragraph">
1971 <p>The value of this attribute specifies the character encoding that should
1972 be used by GUI tools (e.g.
<a href=
"gitk.html">gitk(
1)
</a> and
<a href=
"git-gui.html">git-gui(
1)
</a>) to
1973 display the contents of the relevant file. Note that due to performance
1974 considerations
<a href=
"gitk.html">gitk(
1)
</a> does not use this attribute unless you
1975 manually enable per-file encodings in its options.
</p>
1977 <div class=
"paragraph">
1978 <p>If this attribute is not set or has an invalid value, the value of the
1979 <code>gui.encoding
</code> configuration variable is used instead
1980 (See
<a href=
"git-config.html">git-config(
1)
</a>).
</p>
1987 <h2 id=
"_using_macro_attributes">USING MACRO ATTRIBUTES
</h2>
1988 <div class=
"sectionbody">
1989 <div class=
"paragraph">
1990 <p>You do not want any end-of-line conversions applied to, nor textual diffs
1991 produced for, any binary file you track. You would need to specify e.g.
</p>
1993 <div class=
"listingblock">
1994 <div class=
"content">
1995 <pre>*.jpg -text -diff
</pre>
1998 <div class=
"paragraph">
1999 <p>but that may become cumbersome, when you have many attributes. Using
2000 macro attributes, you can define an attribute that, when set, also
2001 sets or unsets a number of other attributes at the same time. The
2002 system knows a built-in macro attribute,
<code>binary
</code>:
</p>
2004 <div class=
"listingblock">
2005 <div class=
"content">
2006 <pre>*.jpg binary
</pre>
2009 <div class=
"paragraph">
2010 <p>Setting the
"binary" attribute also unsets the
"text" and
"diff"
2011 attributes as above. Note that macro attributes can only be
"Set",
2012 though setting one might have the effect of setting or unsetting other
2013 attributes or even returning other attributes to the
"Unspecified"
2019 <h2 id=
"_defining_macro_attributes">DEFINING MACRO ATTRIBUTES
</h2>
2020 <div class=
"sectionbody">
2021 <div class=
"paragraph">
2022 <p>Custom macro attributes can be defined only in top-level gitattributes
2023 files (
<code>$GIT_DIR/info/attributes
</code>, the .
<code>gitattributes
</code> file at the
2024 top level of the working tree, or the global or system-wide
2025 gitattributes files), not in .
<code>gitattributes
</code> files in working tree
2026 subdirectories. The built-in macro attribute
"binary" is equivalent
2029 <div class=
"listingblock">
2030 <div class=
"content">
2031 <pre>[attr]binary -diff -merge -text
</pre>
2037 <h2 id=
"_notes">NOTES
</h2>
2038 <div class=
"sectionbody">
2039 <div class=
"paragraph">
2040 <p>Git does not follow symbolic links when accessing a .
<code>gitattributes
</code>
2041 file in the working tree. This keeps behavior consistent when the file
2042 is accessed from the index or a tree versus from the filesystem.
</p>
2047 <h2 id=
"_examples">EXAMPLES
</h2>
2048 <div class=
"sectionbody">
2049 <div class=
"paragraph">
2050 <p>If you have these three
<code>gitattributes
</code> file:
</p>
2052 <div class=
"listingblock">
2053 <div class=
"content">
2054 <pre>(in $GIT_DIR/info/attributes)
2061 (in t/.gitattributes)
2067 <div class=
"paragraph">
2068 <p>the attributes given to path
<code>t/abc
</code> are computed as follows:
</p>
2070 <div class=
"olist arabic">
2073 <p>By examining
<code>t/.gitattributes
</code> (which is in the same
2074 directory as the path in question), Git finds that the first
2075 line matches.
<code>merge
</code> attribute is set. It also finds that
2076 the second line matches, and attributes
<code>foo
</code> and
<code>bar
</code>
2080 <p>Then it examines .
<code>gitattributes
</code> (which is in the parent
2081 directory), and finds that the first line matches, but
2082 <code>t/.gitattributes
</code> file already decided how
<code>merge
</code>,
<code>foo
</code>
2083 and
<code>bar
</code> attributes should be given to this path, so it
2084 leaves
<code>foo
</code> and
<code>bar
</code> unset. Attribute
<code>baz
</code> is set.
</p>
2087 <p>Finally it examines
<code>$GIT_DIR/info/attributes
</code>. This file
2088 is used to override the in-tree settings. The first line is
2089 a match, and
<code>foo
</code> is set,
<code>bar
</code> is reverted to unspecified
2090 state, and
<code>baz
</code> is unset.
</p>
2094 <div class=
"paragraph">
2095 <p>As the result, the attributes assignment to
<code>t/abc
</code> becomes:
</p>
2097 <div class=
"listingblock">
2098 <div class=
"content">
2099 <pre>foo set to true
2102 merge set to string value
"filfre"
2103 frotz unspecified
</pre>
2109 <h2 id=
"_see_also">SEE ALSO
</h2>
2110 <div class=
"sectionbody">
2111 <div class=
"paragraph">
2112 <p><a href=
"git-check-attr.html">git-check-attr(
1)
</a>.
</p>
2117 <h2 id=
"_git">GIT
</h2>
2118 <div class=
"sectionbody">
2119 <div class=
"paragraph">
2120 <p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p>
2126 <div id=
"footer-text">
2127 Last updated
2024-
07-
08 15:
33:
45 -
0700