blob: eb810892735bb0fe77dc95fc61a469dc05cab269 [file] [log] [blame]
Junio C Hamanoe90436a2007-04-22 07:22:131<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoc14e6ad2014-10-31 20:25:536<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamanoeef01fe2010-12-13 08:31:587<title>gitattributes(5)</title>
Junio C Hamanoe90436a2007-04-22 07:22:138<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamanoe90436a2007-04-22 07:22:1324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamanoe90436a2007-04-22 07:22:1337
38em {
39 font-style: italic;
Junio C Hamanoeef01fe2010-12-13 08:31:5840 color: navy;
Junio C Hamanoe90436a2007-04-22 07:22:1341}
42
43strong {
44 font-weight: bold;
Junio C Hamanoeef01fe2010-12-13 08:31:5845 color: #083194;
Junio C Hamanoe90436a2007-04-22 07:22:1346}
47
Junio C Hamanoe90436a2007-04-22 07:22:1348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamanoe90436a2007-04-22 07:22:1350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamanoe90436a2007-04-22 07:22:1356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamanoe90436a2007-04-22 07:22:1359 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamanoe90436a2007-04-22 07:22:1370
71div.sectionbody {
Junio C Hamanoe90436a2007-04-22 07:22:1372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamanoeef01fe2010-12-13 08:31:5884ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamanoeef01fe2010-12-13 08:31:5889
Junio C Hamanoc14e6ad2014-10-31 20:25:5390.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamanoe90436a2007-04-22 07:22:1394 padding: 0;
95 margin: 0;
96}
Junio C Hamanoc14e6ad2014-10-31 20:25:5397pre {
98 white-space: pre-wrap;
99}
Junio C Hamanoe90436a2007-04-22 07:22:13100
Junio C Hamano9d971152012-12-19 00:43:11101#author {
Junio C Hamanoe90436a2007-04-22 07:22:13102 color: #527bbd;
Junio C Hamanoe90436a2007-04-22 07:22:13103 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31104 font-size: 1.1em;
Junio C Hamanoe90436a2007-04-22 07:22:13105}
Junio C Hamano9d971152012-12-19 00:43:11106#email {
Junio C Hamanoe90436a2007-04-22 07:22:13107}
Junio C Hamano9d971152012-12-19 00:43:11108#revnumber, #revdate, #revremark {
Junio C Hamanoe90436a2007-04-22 07:22:13109}
110
Junio C Hamano9d971152012-12-19 00:43:11111#footer {
Junio C Hamanoe90436a2007-04-22 07:22:13112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9d971152012-12-19 00:43:11117#footer-text {
Junio C Hamanoe90436a2007-04-22 07:22:13118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9d971152012-12-19 00:43:11121#footer-badges {
Junio C Hamanoe90436a2007-04-22 07:22:13122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9d971152012-12-19 00:43:11126#preamble {
Junio C Hamanoeef01fe2010-12-13 08:31:58127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9d971152012-12-19 00:43:11130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamanoe90436a2007-04-22 07:22:13131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamanoe90436a2007-04-22 07:22:13134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamanoe90436a2007-04-22 07:22:13141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamanoeef01fe2010-12-13 08:31:58149 color: #527bbd;
Junio C Hamanoe90436a2007-04-22 07:22:13150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamanoe90436a2007-04-22 07:22:13173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamanoe90436a2007-04-22 07:22:13180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamanoeef01fe2010-12-13 08:31:58186 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamanoe90436a2007-04-22 07:22:13189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamanoeef01fe2010-12-13 08:31:58191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamanoe90436a2007-04-22 07:22:13193 text-align: right;
194}
Junio C Hamanoeef01fe2010-12-13 08:31:58195
Junio C Hamano9d971152012-12-19 00:43:11196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamanoeef01fe2010-12-13 08:31:58199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamanoe90436a2007-04-22 07:22:13208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamanoe90436a2007-04-22 07:22:13220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamanoe90436a2007-04-22 07:22:13225}
226
Junio C Hamanoe90436a2007-04-22 07:22:13227div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamanoeef01fe2010-12-13 08:31:58229a.image:visited { color: white; }
Junio C Hamanoe90436a2007-04-22 07:22:13230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamanoeef01fe2010-12-13 08:31:58238 font-style: normal;
239 color: navy;
Junio C Hamanoe90436a2007-04-22 07:22:13240}
241dd > *:first-child {
Junio C Hamanoeef01fe2010-12-13 08:31:58242 margin-top: 0.1em;
Junio C Hamanoe90436a2007-04-22 07:22:13243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamanoeef01fe2010-12-13 08:31:58248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamanoe90436a2007-04-22 07:22:13252 list-style-type: lower-alpha;
253}
Junio C Hamanoeef01fe2010-12-13 08:31:58254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamanoe90436a2007-04-22 07:22:13270
Junio C Hamanoe90436a2007-04-22 07:22:13271tfoot {
272 font-weight: bold;
273}
Junio C Hamanoeef01fe2010-12-13 08:31:58274td > div.verse {
275 white-space: pre;
276}
Junio C Hamanoeef01fe2010-12-13 08:31:58277
278div.hdlist {
Junio C Hamanoe90436a2007-04-22 07:22:13279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamanoeef01fe2010-12-13 08:31:58282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31284}
Junio C Hamanoeef01fe2010-12-13 08:31:58285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamanoe90436a2007-04-22 07:22:13289 vertical-align: top;
Junio C Hamanoeef01fe2010-12-13 08:31:58290 font-style: normal;
Junio C Hamanoe90436a2007-04-22 07:22:13291 padding-right: 0.8em;
Junio C Hamanoeef01fe2010-12-13 08:31:58292 color: navy;
Junio C Hamanoe90436a2007-04-22 07:22:13293}
Junio C Hamanoeef01fe2010-12-13 08:31:58294td.hdlist2 {
Junio C Hamanoe90436a2007-04-22 07:22:13295 vertical-align: top;
296}
Junio C Hamanoeef01fe2010-12-13 08:31:58297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamanoe90436a2007-04-22 07:22:13305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9d971152012-12-19 00:43:11333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamanoe90436a2007-04-22 07:22:13340}
Junio C Hamanoba4b9282008-07-06 05:20:31341
Junio C Hamano9d971152012-12-19 00:43:11342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9d971152012-12-19 00:43:11350#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31351 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamanoc14e6ad2014-10-31 20:25:53358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9d971152012-12-19 00:43:11374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamanoc14e6ad2014-10-31 20:25:53416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9d971152012-12-19 00:43:11418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamanoeef01fe2010-12-13 08:31:58521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9d971152012-12-19 00:43:11526body.manpage h2 {
Junio C Hamanoeef01fe2010-12-13 08:31:58527 border-style: none;
528}
Junio C Hamano9d971152012-12-19 00:43:11529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamanoeef01fe2010-12-13 08:31:58531}
532
533@media print {
Junio C Hamano9d971152012-12-19 00:43:11534 body.manpage div#toc { display: none; }
Junio C Hamanoeef01fe2010-12-13 08:31:58535}
Junio C Hamanoc14e6ad2014-10-31 20:25:53536
537
Junio C Hamanoe90436a2007-04-22 07:22:13538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamanoc14e6ad2014-10-31 20:25:53582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamanoc14e6ad2014-10-31 20:25:53657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9d971152012-12-19 00:43:11672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9d971152012-12-19 00:43:11705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9d971152012-12-19 00:43:11730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamanoe90436a2007-04-22 07:22:13733</head>
Junio C Hamano9d971152012-12-19 00:43:11734<body class="manpage">
Junio C Hamanoe90436a2007-04-22 07:22:13735<div id="header">
736<h1>
737gitattributes(5) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>gitattributes -
742 defining attributes per path
743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11747<div class="sect1">
Junio C Hamanoeef01fe2010-12-13 08:31:58748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamanoe90436a2007-04-22 07:22:13749<div class="sectionbody">
Junio C Hamanoeef01fe2010-12-13 08:31:58750<div class="paragraph"><p>$GIT_DIR/info/attributes, .gitattributes</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:13751</div>
Junio C Hamano9d971152012-12-19 00:43:11752</div>
753<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31754<h2 id="_description">DESCRIPTION</h2>
Junio C Hamanoe90436a2007-04-22 07:22:13755<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:53756<div class="paragraph"><p>A <code>gitattributes</code> file is a simple text file that gives
757<code>attributes</code> to pathnames.</p></div>
758<div class="paragraph"><p>Each line in <code>gitattributes</code> file is of form:</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:13759<div class="literalblock">
760<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53761<pre><code>pattern attr1 attr2 ...</code></pre>
Junio C Hamanoe90436a2007-04-22 07:22:13762</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58763<div class="paragraph"><p>That is, a pattern followed by an attributes list,
Junio C Hamanod533bdb2009-02-25 09:56:58764separated by whitespaces. When the pattern matches the
Junio C Hamanoe90436a2007-04-22 07:22:13765path in question, the attributes listed on the line are given to
Junio C Hamanoba4b9282008-07-06 05:20:31766the path.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58767<div class="paragraph"><p>Each attribute can be in one of these states for a given path:</p></div>
768<div class="dlist"><dl>
769<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13770Set
771</dt>
772<dd>
773<p>
774 The path has the attribute with special value "true";
775 this is specified by listing only the name of the
776 attribute in the attribute list.
777</p>
778</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58779<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13780Unset
781</dt>
782<dd>
783<p>
784 The path has the attribute with special value "false";
785 this is specified by listing the name of the attribute
Junio C Hamanoc14e6ad2014-10-31 20:25:53786 prefixed with a dash <code>-</code> in the attribute list.
Junio C Hamanoe90436a2007-04-22 07:22:13787</p>
788</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58789<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13790Set to a value
791</dt>
792<dd>
793<p>
794 The path has the attribute with specified string value;
795 this is specified by listing the name of the attribute
Junio C Hamanoc14e6ad2014-10-31 20:25:53796 followed by an equal sign <code>=</code> and its value in the
Junio C Hamanoe90436a2007-04-22 07:22:13797 attribute list.
798</p>
799</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58800<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13801Unspecified
802</dt>
803<dd>
804<p>
Junio C Hamanod533bdb2009-02-25 09:56:58805 No pattern matches the path, and nothing says if
Junio C Hamano22572e72007-04-25 05:59:25806 the path has or does not have the attribute, the
807 attribute for the path is said to be Unspecified.
Junio C Hamanoe90436a2007-04-22 07:22:13808</p>
809</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31810</dl></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58811<div class="paragraph"><p>When more than one pattern matches the path, a later line
Junio C Hamano22572e72007-04-25 05:59:25812overrides an earlier line. This overriding is done per
Junio C Hamanod533bdb2009-02-25 09:56:58813attribute. The rules how the pattern matches paths are the
Junio C Hamanoc14e6ad2014-10-31 20:25:53814same as in <code>.gitignore</code> files; see <a href="gitignore.html">gitignore(5)</a>.
815Unlike <code>.gitignore</code>, negative patterns are forbidden.</p></div>
Junio C Hamano076ffcc2013-02-06 05:13:21816<div class="paragraph"><p>When deciding what attributes are assigned to a path, Git
Junio C Hamanoc14e6ad2014-10-31 20:25:53817consults <code>$GIT_DIR/info/attributes</code> file (which has the highest
818precedence), <code>.gitattributes</code> file in the same directory as the
Junio C Hamanob4a9ede2009-04-08 07:36:32819path in question, and its parent directories up to the toplevel of the
Junio C Hamanoc14e6ad2014-10-31 20:25:53820work tree (the further the directory that contains <code>.gitattributes</code>
Junio C Hamano3b4609d2010-09-30 00:04:34821is from the path in question, the lower its precedence). Finally
822global and system-wide files are considered (they have the lowest
823precedence).</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53824<div class="paragraph"><p>When the <code>.gitattributes</code> file is missing from the work tree, the
Junio C Hamano6631a092012-10-10 22:50:57825path in the index is used as a fall-back. During checkout process,
Junio C Hamanoc14e6ad2014-10-31 20:25:53826<code>.gitattributes</code> in the index is used and then the file in the
Junio C Hamano6631a092012-10-10 22:50:57827working tree is used as a fall-back.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58828<div class="paragraph"><p>If you wish to affect only a single repository (i.e., to assign
Junio C Hamano3b4609d2010-09-30 00:04:34829attributes to files that are particular to
Junio C Hamanoeef01fe2010-12-13 08:31:58830one user&#8217;s workflow for that repository), then
Junio C Hamanoc14e6ad2014-10-31 20:25:53831attributes should be placed in the <code>$GIT_DIR/info/attributes</code> file.
Junio C Hamano99dc24a2008-03-27 23:49:50832Attributes which should be version-controlled and distributed to other
833repositories (i.e., attributes of interest to all users) should go into
Junio C Hamanoc14e6ad2014-10-31 20:25:53834<code>.gitattributes</code> files. Attributes that should affect all repositories
Junio C Hamano3b4609d2010-09-30 00:04:34835for a single user should be placed in a file specified by the
Junio C Hamano322c6242015-03-23 21:32:46836<code>core.attributesFile</code> configuration option (see <a href="git-config.html">git-config(1)</a>).
Junio C Hamano8edb4c72012-07-09 20:33:55837Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME
838is either not set or empty, $HOME/.config/git/attributes is used instead.
Junio C Hamano3b4609d2010-09-30 00:04:34839Attributes for all users on a system should be placed in the
Junio C Hamanoc14e6ad2014-10-31 20:25:53840<code>$(prefix)/etc/gitattributes</code> file.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58841<div class="paragraph"><p>Sometimes you would need to override an setting of an attribute
Junio C Hamanoc14e6ad2014-10-31 20:25:53842for a path to <code>Unspecified</code> state. This can be done by listing
843the name of the attribute prefixed with an exclamation point <code>!</code>.</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:13844</div>
Junio C Hamano9d971152012-12-19 00:43:11845</div>
846<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31847<h2 id="_effects">EFFECTS</h2>
Junio C Hamanoe90436a2007-04-22 07:22:13848<div class="sectionbody">
Junio C Hamano076ffcc2013-02-06 05:13:21849<div class="paragraph"><p>Certain operations by Git can be influenced by assigning
Junio C Hamano2a8f6dc2007-07-09 08:48:38850particular attributes to a path. Currently, the following
Junio C Hamanoba4b9282008-07-06 05:20:31851operations are attributes-aware.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11852<div class="sect2">
853<h3 id="_checking_out_and_checking_in">Checking-out and checking-in</h3>
Junio C Hamanoeef01fe2010-12-13 08:31:58854<div class="paragraph"><p>These attributes affect how the contents stored in the
Junio C Hamanoe90436a2007-04-22 07:22:13855repository are copied to the working tree files when commands
Junio C Hamano1aa40d22010-01-21 17:46:43856such as <em>git checkout</em> and <em>git merge</em> run. They also affect how
Junio C Hamano076ffcc2013-02-06 05:13:21857Git stores the contents you prepare in the working tree in the
Junio C Hamano1aa40d22010-01-21 17:46:43858repository upon <em>git add</em> and <em>git commit</em>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11859<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:53860<h4 id="_code_text_code"><code>text</code></h4>
Junio C Hamanoeef01fe2010-12-13 08:31:58861<div class="paragraph"><p>This attribute enables and controls end-of-line normalization. When a
Junio C Hamanobb88cf42010-06-21 15:23:55862text file is normalized, its line endings are converted to LF in the
863repository. To control what line ending style is used in the working
Junio C Hamanoc14e6ad2014-10-31 20:25:53864directory, use the <code>eol</code> attribute for a single file and the
865<code>core.eol</code> configuration variable for all text files.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58866<div class="dlist"><dl>
867<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13868Set
869</dt>
870<dd>
871<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53872 Setting the <code>text</code> attribute on a path enables end-of-line
Junio C Hamanobb88cf42010-06-21 15:23:55873 normalization and marks the path as a text file. End-of-line
874 conversion takes place without guessing the content type.
Junio C Hamanoe90436a2007-04-22 07:22:13875</p>
876</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58877<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13878Unset
879</dt>
880<dd>
881<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53882 Unsetting the <code>text</code> attribute on a path tells Git not to
Junio C Hamanofcb740a2008-08-31 06:32:05883 attempt any end-of-line conversion upon checkin or checkout.
Junio C Hamanoe90436a2007-04-22 07:22:13884</p>
885</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58886<dt class="hdlist1">
Junio C Hamanobb88cf42010-06-21 15:23:55887Set to string value "auto"
888</dt>
889<dd>
890<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53891 When <code>text</code> is set to "auto", the path is marked for automatic
Junio C Hamano076ffcc2013-02-06 05:13:21892 end-of-line normalization. If Git decides that the content is
Junio C Hamanobb88cf42010-06-21 15:23:55893 text, its line endings are normalized to LF on checkin.
894</p>
895</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58896<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:13897Unspecified
898</dt>
899<dd>
900<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53901 If the <code>text</code> attribute is unspecified, Git uses the
902 <code>core.autocrlf</code> configuration variable to determine if the
Junio C Hamanobb88cf42010-06-21 15:23:55903 file should be converted.
Junio C Hamanoe90436a2007-04-22 07:22:13904</p>
905</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31906</dl></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53907<div class="paragraph"><p>Any other value causes Git to act as if <code>text</code> has been left
Junio C Hamanobb88cf42010-06-21 15:23:55908unspecified.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11909</div>
910<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:53911<h4 id="_code_eol_code"><code>eol</code></h4>
Junio C Hamanoeef01fe2010-12-13 08:31:58912<div class="paragraph"><p>This attribute sets a specific line-ending style to be used in the
Junio C Hamanobb88cf42010-06-21 15:23:55913working directory. It enables end-of-line normalization without any
Junio C Hamanoc14e6ad2014-10-31 20:25:53914content checks, effectively setting the <code>text</code> attribute.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58915<div class="dlist"><dl>
916<dt class="hdlist1">
Junio C Hamanobb88cf42010-06-21 15:23:55917Set to string value "crlf"
918</dt>
919<dd>
920<p>
Junio C Hamano076ffcc2013-02-06 05:13:21921 This setting forces Git to normalize line endings for this
Junio C Hamanobb88cf42010-06-21 15:23:55922 file on checkin and convert them to CRLF when the file is
923 checked out.
924</p>
925</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:58926<dt class="hdlist1">
Junio C Hamanobb88cf42010-06-21 15:23:55927Set to string value "lf"
928</dt>
929<dd>
930<p>
Junio C Hamano076ffcc2013-02-06 05:13:21931 This setting forces Git to normalize line endings to LF on
Junio C Hamanobb88cf42010-06-21 15:23:55932 checkin and prevents conversion to CRLF when the file is
933 checked out.
934</p>
935</dd>
936</dl></div>
Junio C Hamano9d971152012-12-19 00:43:11937</div>
938<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:53939<h4 id="_backwards_compatibility_with_code_crlf_code_attribute">Backwards compatibility with <code>crlf</code> attribute</h4>
940<div class="paragraph"><p>For backwards compatibility, the <code>crlf</code> attribute is interpreted as
Junio C Hamanobb88cf42010-06-21 15:23:55941follows:</p></div>
942<div class="listingblock">
943<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53944<pre><code>crlf text
Junio C Hamanobb88cf42010-06-21 15:23:55945-crlf -text
Junio C Hamanoc14e6ad2014-10-31 20:25:53946crlf=input eol=lf</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:55947</div></div>
Junio C Hamano9d971152012-12-19 00:43:11948</div>
949<div class="sect3">
Junio C Hamanobb88cf42010-06-21 15:23:55950<h4 id="_end_of_line_conversion">End-of-line conversion</h4>
Junio C Hamano076ffcc2013-02-06 05:13:21951<div class="paragraph"><p>While Git normally leaves file contents alone, it can be configured to
Junio C Hamanobb88cf42010-06-21 15:23:55952normalize line endings to LF in the repository and, optionally, to
953convert them to CRLF when files are checked out.</p></div>
Junio C Hamano076ffcc2013-02-06 05:13:21954<div class="paragraph"><p>Here is an example that will make Git normalize .txt, .vcproj and .sh
Junio C Hamanobb88cf42010-06-21 15:23:55955files, ensure that .vcproj files have CRLF and .sh files have LF in
956the working directory, and prevent .jpg files from being normalized
957regardless of their content.</p></div>
958<div class="listingblock">
959<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53960<pre><code>*.txt text
Junio C Hamanobb88cf42010-06-21 15:23:55961*.vcproj eol=crlf
962*.sh eol=lf
Junio C Hamanoc14e6ad2014-10-31 20:25:53963*.jpg -text</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:55964</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58965<div class="paragraph"><p>Other source code management systems normalize all text files in their
Junio C Hamanobb88cf42010-06-21 15:23:55966repositories, and there are two ways to enable similar automatic
Junio C Hamano076ffcc2013-02-06 05:13:21967normalization in Git.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58968<div class="paragraph"><p>If you simply want to have CRLF line endings in your working directory
Junio C Hamanobb88cf42010-06-21 15:23:55969regardless of the repository you are working with, you can set the
970config variable "core.autocrlf" without changing any attributes.</p></div>
971<div class="listingblock">
972<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53973<pre><code>[core]
974 autocrlf = true</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:55975</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58976<div class="paragraph"><p>This does not force normalization of all text files, but does ensure
Junio C Hamanobb88cf42010-06-21 15:23:55977that text files that you introduce to the repository have their line
978endings normalized to LF when they are added, and that files that are
979already normalized in the repository stay normalized.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:58980<div class="paragraph"><p>If you want to interoperate with a source code management system that
Junio C Hamanobb88cf42010-06-21 15:23:55981enforces end-of-line normalization, or you simply want all text files
Junio C Hamanoc14e6ad2014-10-31 20:25:53982in your repository to be normalized, you should instead set the <code>text</code>
Junio C Hamanoeef01fe2010-12-13 08:31:58983attribute to "auto" for <em>all</em> files.</p></div>
Junio C Hamanobb88cf42010-06-21 15:23:55984<div class="listingblock">
985<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53986<pre><code>* text=auto</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:55987</div></div>
Junio C Hamano076ffcc2013-02-06 05:13:21988<div class="paragraph"><p>This ensures that all files that Git considers to be text will have
Junio C Hamanoc14e6ad2014-10-31 20:25:53989normalized (LF) line endings in the repository. The <code>core.eol</code>
Junio C Hamano076ffcc2013-02-06 05:13:21990configuration variable controls which line endings Git will use for
Junio C Hamanobb88cf42010-06-21 15:23:55991normalized files in your working directory; the default is to use the
Junio C Hamanoc14e6ad2014-10-31 20:25:53992native line ending for your platform, or CRLF if <code>core.autocrlf</code> is
Junio C Hamanobb88cf42010-06-21 15:23:55993set.</p></div>
994<div class="admonitionblock">
995<table><tr>
996<td class="icon">
997<div class="title">Note</div>
998</td>
Junio C Hamanoc14e6ad2014-10-31 20:25:53999<td class="content">When <code>text=auto</code> normalization is enabled in an existing
Junio C Hamanobb88cf42010-06-21 15:23:551000repository, any text files containing CRLFs should be normalized. If
1001they are not they will be normalized the next time someone tries to
1002change them, causing unfortunate misattribution. From a clean working
1003directory:</td>
1004</tr></table>
1005</div>
1006<div class="listingblock">
1007<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531008<pre><code>$ echo "* text=auto" &gt;&gt;.gitattributes
Junio C Hamano076ffcc2013-02-06 05:13:211009$ rm .git/index # Remove the index to force Git to
Junio C Hamanobb88cf42010-06-21 15:23:551010$ git reset # re-scan the working directory
1011$ git status # Show files that will be normalized
1012$ git add -u
1013$ git add .gitattributes
Junio C Hamanoc14e6ad2014-10-31 20:25:531014$ git commit -m "Introduce end-of-line normalization"</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551015</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581016<div class="paragraph"><p>If any files that should not be normalized show up in <em>git status</em>,
Junio C Hamanoc14e6ad2014-10-31 20:25:531017unset their <code>text</code> attribute before running <em>git add -u</em>.</p></div>
Junio C Hamanobb88cf42010-06-21 15:23:551018<div class="listingblock">
1019<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531020<pre><code>manual.pdf -text</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551021</div></div>
Junio C Hamano076ffcc2013-02-06 05:13:211022<div class="paragraph"><p>Conversely, text files that Git does not detect can have normalization
Junio C Hamanobb88cf42010-06-21 15:23:551023enabled manually.</p></div>
1024<div class="listingblock">
1025<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531026<pre><code>weirdchars.txt text</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551027</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531028<div class="paragraph"><p>If <code>core.safecrlf</code> is set to "true" or "warn", Git verifies if
Junio C Hamano26e590a2008-02-17 03:53:511029the conversion is reversible for the current setting of
Junio C Hamanoc14e6ad2014-10-31 20:25:531030<code>core.autocrlf</code>. For "true", Git rejects irreversible
Junio C Hamano076ffcc2013-02-06 05:13:211031conversions; for "warn", Git only prints a warning but accepts
Junio C Hamano26e590a2008-02-17 03:53:511032an irreversible conversion. The safety triggers to prevent such
1033a conversion done to the files in the work tree, but there are a
Junio C Hamanoba4b9282008-07-06 05:20:311034few exceptions. Even though&#8230;</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581035<div class="ulist"><ul>
Junio C Hamano26e590a2008-02-17 03:53:511036<li>
1037<p>
Junio C Hamano1aa40d22010-01-21 17:46:431038<em>git add</em> itself does not touch the files in the work tree, the
Junio C Hamano26e590a2008-02-17 03:53:511039 next checkout would, so the safety triggers;
1040</p>
1041</li>
1042<li>
1043<p>
Junio C Hamano1aa40d22010-01-21 17:46:431044<em>git apply</em> to update a text file with a patch does touch the files
Junio C Hamano26e590a2008-02-17 03:53:511045 in the work tree, but the operation is about text files and CRLF
1046 conversion is about fixing the line ending inconsistencies, so the
1047 safety does not trigger;
1048</p>
1049</li>
1050<li>
1051<p>
Junio C Hamano1aa40d22010-01-21 17:46:431052<em>git diff</em> itself does not touch the files in the work tree, it is
1053 often run to inspect the changes you intend to next <em>git add</em>. To
Junio C Hamano26e590a2008-02-17 03:53:511054 catch potential problems early, safety triggers.
1055</p>
1056</li>
Junio C Hamanoba4b9282008-07-06 05:20:311057</ul></div>
Junio C Hamano9d971152012-12-19 00:43:111058</div>
1059<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531060<h4 id="_code_ident_code"><code>ident</code></h4>
1061<div class="paragraph"><p>When the attribute <code>ident</code> is set for a path, Git replaces
1062<code>$Id$</code> in the blob object with <code>$Id:</code>, followed by the
Junio C Hamano469d60e2007-04-29 18:30:34106340-character hexadecimal blob object name, followed by a dollar
Junio C Hamanoc14e6ad2014-10-31 20:25:531064sign <code>$</code> upon checkout. Any byte sequence that begins with
1065<code>$Id:</code> and ends with <code>$</code> in the worktree file is replaced
1066with <code>$Id$</code> upon check-in.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111067</div>
1068<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531069<h4 id="_code_filter_code"><code>filter</code></h4>
1070<div class="paragraph"><p>A <code>filter</code> attribute can be set to a string value that names a
Junio C Hamanoba4b9282008-07-06 05:20:311071filter driver specified in the configuration.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531072<div class="paragraph"><p>A filter driver consists of a <code>clean</code> command and a <code>smudge</code>
Junio C Hamano469d60e2007-04-29 18:30:341073command, either of which can be left unspecified. Upon
Junio C Hamanoc14e6ad2014-10-31 20:25:531074checkout, when the <code>smudge</code> command is specified, the command is
Junio C Hamano361c1332007-11-14 12:17:221075fed the blob object from its standard input, and its standard
1076output is used to update the worktree file. Similarly, the
Junio C Hamanoc14e6ad2014-10-31 20:25:531077<code>clean</code> command is used to convert the contents of worktree file
Junio C Hamanoba4b9282008-07-06 05:20:311078upon checkin.</p></div>
Junio C Hamano90a5b7b2012-02-28 23:40:311079<div class="paragraph"><p>One use of the content filtering is to massage the content into a shape
1080that is more convenient for the platform, filesystem, and the user to use.
1081For this mode of operation, the key phrase here is "more convenient" and
1082not "turning something unusable into usable". In other words, the intent
1083is that if someone unsets the filter driver definition, or does not have
1084the appropriate filter program, the project should still be usable.</p></div>
1085<div class="paragraph"><p>Another use of the content filtering is to store the content that cannot
1086be directly used in the repository (e.g. a UUID that refers to the true
Junio C Hamano076ffcc2013-02-06 05:13:211087content stored outside Git, or an encrypted content) and turn it into a
Junio C Hamano90a5b7b2012-02-28 23:40:311088usable form upon checkout (e.g. download the external content, or decrypt
1089the encrypted content).</p></div>
1090<div class="paragraph"><p>These two filters behave differently, and by default, a filter is taken as
1091the former, massaging the contents into more convenient shape. A missing
1092filter driver definition in the config, or a filter driver that exits with
1093a non-zero status, is not an error but makes the filter a no-op passthru.</p></div>
1094<div class="paragraph"><p>You can declare that a filter turns a content that by itself is unusable
1095into a usable content by setting the filter.&lt;driver&gt;.required configuration
Junio C Hamanoc14e6ad2014-10-31 20:25:531096variable to <code>true</code>.</p></div>
1097<div class="paragraph"><p>For example, in .gitattributes, you would assign the <code>filter</code>
Junio C Hamano6a548ef2009-12-17 00:16:201098attribute for paths.</p></div>
1099<div class="listingblock">
1100<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531101<pre><code>*.c filter=indent</code></pre>
Junio C Hamano6a548ef2009-12-17 00:16:201102</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581103<div class="paragraph"><p>Then you would define a "filter.indent.clean" and "filter.indent.smudge"
Junio C Hamano6a548ef2009-12-17 00:16:201104configuration in your .git/config to specify a pair of commands to
1105modify the contents of C programs when the source files are checked
1106in ("clean" is run) and checked out (no change is made because the
1107command is "cat").</p></div>
1108<div class="listingblock">
1109<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531110<pre><code>[filter "indent"]
Junio C Hamano6a548ef2009-12-17 00:16:201111 clean = indent
Junio C Hamanoc14e6ad2014-10-31 20:25:531112 smudge = cat</code></pre>
Junio C Hamano6a548ef2009-12-17 00:16:201113</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531114<div class="paragraph"><p>For best results, <code>clean</code> should not alter its output further if it is
Junio C Hamanoeef01fe2010-12-13 08:31:581115run twice ("clean&#8594;clean" should be equivalent to "clean"), and
Junio C Hamanoc14e6ad2014-10-31 20:25:531116multiple <code>smudge</code> commands should not alter <code>clean</code>'s output
Junio C Hamanoeef01fe2010-12-13 08:31:581117("smudge&#8594;smudge&#8594;clean" should be equivalent to "clean"). See the
Junio C Hamano2db3e752010-09-03 21:33:061118section on merging below.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581119<div class="paragraph"><p>The "indent" filter is well-behaved in this regard: it will not modify
Junio C Hamano2db3e752010-09-03 21:33:061120input that is already correctly indented. In this case, the lack of a
Junio C Hamanoeef01fe2010-12-13 08:31:581121smudge filter means that the clean filter <em>must</em> accept its own output
Junio C Hamano2db3e752010-09-03 21:33:061122without modifying it.</p></div>
Junio C Hamano90a5b7b2012-02-28 23:40:311123<div class="paragraph"><p>If a filter <em>must</em> succeed in order to make the stored contents usable,
Junio C Hamanoc14e6ad2014-10-31 20:25:531124you can declare that the filter is <code>required</code>, in the configuration:</p></div>
Junio C Hamano90a5b7b2012-02-28 23:40:311125<div class="listingblock">
1126<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531127<pre><code>[filter "crypt"]
Junio C Hamano90a5b7b2012-02-28 23:40:311128 clean = openssl enc ...
1129 smudge = openssl enc -d ...
Junio C Hamanoc14e6ad2014-10-31 20:25:531130 required</code></pre>
Junio C Hamano90a5b7b2012-02-28 23:40:311131</div></div>
Junio C Hamanoe0552e42011-01-06 00:34:471132<div class="paragraph"><p>Sequence "%f" on the filter command line is replaced with the name of
1133the file the filter is working on. A filter might use this in keyword
1134substitution. For example:</p></div>
1135<div class="listingblock">
1136<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531137<pre><code>[filter "p4"]
Junio C Hamanoe0552e42011-01-06 00:34:471138 clean = git-p4-filter --clean %f
Junio C Hamanoc14e6ad2014-10-31 20:25:531139 smudge = git-p4-filter --smudge %f</code></pre>
Junio C Hamanoe0552e42011-01-06 00:34:471140</div></div>
Junio C Hamano9d971152012-12-19 00:43:111141</div>
1142<div class="sect3">
Junio C Hamanoba4b9282008-07-06 05:20:311143<h4 id="_interaction_between_checkin_checkout_attributes">Interaction between checkin/checkout attributes</h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581144<div class="paragraph"><p>In the check-in codepath, the worktree file is first converted
Junio C Hamanoc14e6ad2014-10-31 20:25:531145with <code>filter</code> driver (if specified and corresponding driver
1146defined), then the result is processed with <code>ident</code> (if
1147specified), and then finally with <code>text</code> (again, if specified
Junio C Hamanoba4b9282008-07-06 05:20:311148and applicable).</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581149<div class="paragraph"><p>In the check-out codepath, the blob content is first converted
Junio C Hamanoc14e6ad2014-10-31 20:25:531150with <code>text</code>, and then <code>ident</code> and fed to <code>filter</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111151</div>
1152<div class="sect3">
Junio C Hamano2db3e752010-09-03 21:33:061153<h4 id="_merging_branches_with_differing_checkin_checkout_attributes">Merging branches with differing checkin/checkout attributes</h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581154<div class="paragraph"><p>If you have added attributes to a file that cause the canonical
Junio C Hamano2db3e752010-09-03 21:33:061155repository format for that file to change, such as adding a
1156clean/smudge filter or text/eol/ident attributes, merging anything
1157where the attribute is not in place would normally cause merge
1158conflicts.</p></div>
Junio C Hamano076ffcc2013-02-06 05:13:211159<div class="paragraph"><p>To prevent these unnecessary merge conflicts, Git can be told to run a
Junio C Hamano2db3e752010-09-03 21:33:061160virtual check-out and check-in of all three stages of a file when
Junio C Hamanoc14e6ad2014-10-31 20:25:531161resolving a three-way merge by setting the <code>merge.renormalize</code>
Junio C Hamano2db3e752010-09-03 21:33:061162configuration variable. This prevents changes caused by check-in
1163conversion from causing spurious merge conflicts when a converted file
1164is merged with an unconverted file.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581165<div class="paragraph"><p>As long as a "smudge&#8594;clean" results in the same output as a "clean"
Junio C Hamano2db3e752010-09-03 21:33:061166even on files that are already smudged, this strategy will
1167automatically resolve all filter-related conflicts. Filters that do
1168not act in this way may cause additional merge conflicts that must be
1169resolved manually.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111170</div>
1171</div>
1172<div class="sect2">
1173<h3 id="_generating_diff_text">Generating diff text</h3>
1174<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531175<h4 id="_code_diff_code"><code>diff</code></h4>
1176<div class="paragraph"><p>The attribute <code>diff</code> affects how Git generates diffs for particular
Junio C Hamano076ffcc2013-02-06 05:13:211177files. It can tell Git whether to generate a textual patch for the path
Junio C Hamano28363492008-11-14 08:26:311178or to treat the path as a binary file. It can also affect what line is
Junio C Hamanoc14e6ad2014-10-31 20:25:531179shown on the hunk header <code>@@ -k,l +n,m @@</code> line, tell Git to use an
Junio C Hamano076ffcc2013-02-06 05:13:211180external command to generate the diff, or ask Git to convert binary
Junio C Hamano28363492008-11-14 08:26:311181files to a text format before generating the diff.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581182<div class="dlist"><dl>
1183<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131184Set
1185</dt>
1186<dd>
1187<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531188 A path to which the <code>diff</code> attribute is set is treated
Junio C Hamanoe90436a2007-04-22 07:22:131189 as text, even when they contain byte values that
1190 normally never appear in text files, such as NUL.
1191</p>
1192</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581193<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131194Unset
1195</dt>
1196<dd>
1197<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531198 A path to which the <code>diff</code> attribute is unset will
1199 generate <code>Binary files differ</code> (or a binary patch, if
Junio C Hamano28363492008-11-14 08:26:311200 binary patches are enabled).
Junio C Hamanoe90436a2007-04-22 07:22:131201</p>
1202</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581203<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131204Unspecified
1205</dt>
1206<dd>
1207<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531208 A path to which the <code>diff</code> attribute is unspecified
Junio C Hamanoe90436a2007-04-22 07:22:131209 first gets its contents inspected, and if it looks like
Junio C Hamano8e61f1f2014-09-11 21:53:451210 text and is smaller than core.bigFileThreshold, it is treated
Junio C Hamanoc14e6ad2014-10-31 20:25:531211 as text. Otherwise it would generate <code>Binary files differ</code>.
Junio C Hamanoe90436a2007-04-22 07:22:131212</p>
1213</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581214<dt class="hdlist1">
Junio C Hamano9db95ca2007-04-23 07:27:051215String
1216</dt>
1217<dd>
1218<p>
Junio C Hamano28363492008-11-14 08:26:311219 Diff is shown using the specified diff driver. Each driver may
1220 specify one or more options, as described in the following
1221 section. The options for the diff driver "foo" are defined
1222 by the configuration variables in the "diff.foo" section of the
Junio C Hamano076ffcc2013-02-06 05:13:211223 Git config file.
Junio C Hamano9db95ca2007-04-23 07:27:051224</p>
1225</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311226</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111227</div>
1228<div class="sect3">
Junio C Hamano28363492008-11-14 08:26:311229<h4 id="_defining_an_external_diff_driver">Defining an external diff driver</h4>
Junio C Hamanoc14e6ad2014-10-31 20:25:531230<div class="paragraph"><p>The definition of a diff driver is done in <code>gitconfig</code>, not
1231<code>gitattributes</code> file, so strictly speaking this manual page is a
Junio C Hamanoba4b9282008-07-06 05:20:311232wrong place to talk about it. However&#8230;</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531233<div class="paragraph"><p>To define an external diff driver <code>jcdiff</code>, add a section to your
1234<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p></div>
Junio C Hamano9db95ca2007-04-23 07:27:051235<div class="listingblock">
1236<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531237<pre><code>[diff "jcdiff"]
1238 command = j-c-diff</code></pre>
Junio C Hamano9db95ca2007-04-23 07:27:051239</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531240<div class="paragraph"><p>When Git needs to show you a diff for the path with <code>diff</code>
1241attribute set to <code>jcdiff</code>, it calls the command you specified
1242with the above configuration, i.e. <code>j-c-diff</code>, with 7
1243parameters, just like <code>GIT_EXTERNAL_DIFF</code> program is called.
Junio C Hamanoa28a9202012-06-21 07:08:231244See <a href="git.html">git(1)</a> for details.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111245</div>
1246<div class="sect3">
Junio C Hamanoba4b9282008-07-06 05:20:311247<h4 id="_defining_a_custom_hunk_header">Defining a custom hunk-header</h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581248<div class="paragraph"><p>Each group of changes (called a "hunk") in the textual diff output
Junio C Hamanoba4b9282008-07-06 05:20:311249is prefixed with a line of the form:</p></div>
Junio C Hamano2a8f6dc2007-07-09 08:48:381250<div class="literalblock">
1251<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531252<pre><code>@@ -k,l +n,m @@ TEXT</code></pre>
Junio C Hamano2a8f6dc2007-07-09 08:48:381253</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581254<div class="paragraph"><p>This is called a <em>hunk header</em>. The "TEXT" portion is by default a line
Junio C Hamano5e4d8de2008-09-19 06:27:021255that begins with an alphabet, an underscore or a dollar sign; this
1256matches what GNU <em>diff -p</em> output uses. This default selection however
1257is not suited for some contents, and you can use a customized pattern
1258to make a selection.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531259<div class="paragraph"><p>First, in .gitattributes, you would assign the <code>diff</code> attribute
Junio C Hamanoba4b9282008-07-06 05:20:311260for paths.</p></div>
Junio C Hamano2a8f6dc2007-07-09 08:48:381261<div class="listingblock">
1262<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531263<pre><code>*.tex diff=tex</code></pre>
Junio C Hamano2a8f6dc2007-07-09 08:48:381264</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581265<div class="paragraph"><p>Then, you would define a "diff.tex.xfuncname" configuration to
Junio C Hamano2a8f6dc2007-07-09 08:48:381266specify a regular expression that matches a line that you would
Junio C Hamano3bd66e92009-04-18 06:17:561267want to appear as the hunk header "TEXT". Add a section to your
Junio C Hamanoc14e6ad2014-10-31 20:25:531268<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p></div>
Junio C Hamano2a8f6dc2007-07-09 08:48:381269<div class="listingblock">
1270<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531271<pre><code>[diff "tex"]
1272 xfuncname = "^(\\\\(sub)*section\\{.*)$"</code></pre>
Junio C Hamano2a8f6dc2007-07-09 08:48:381273</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581274<div class="paragraph"><p>Note. A single level of backslashes are eaten by the
Junio C Hamano2a8f6dc2007-07-09 08:48:381275configuration file parser, so you would need to double the
1276backslashes; the pattern above picks a line that begins with a
Junio C Hamanoc14e6ad2014-10-31 20:25:531277backslash, and zero or more occurrences of <code>sub</code> followed by
1278<code>section</code> followed by open brace, to the end of line.</p></div>
1279<div class="paragraph"><p>There are a few built-in patterns to make this easier, and <code>tex</code>
Junio C Hamano2a8f6dc2007-07-09 08:48:381280is one of them, so you do not have to write the above in your
1281configuration file (you still need to enable this with the
Junio C Hamanoc14e6ad2014-10-31 20:25:531282attribute mechanism, via <code>.gitattributes</code>). The following built in
Junio C Hamanoa76cb0d2008-08-13 20:04:101283patterns are available:</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581284<div class="ulist"><ul>
Junio C Hamanoa76cb0d2008-08-13 20:04:101285<li>
1286<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531287<code>ada</code> suitable for source code in the Ada language.
Junio C Hamano4f07aec2012-09-25 19:08:441288</p>
1289</li>
1290<li>
1291<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531292<code>bibtex</code> suitable for files with BibTeX coded references.
Junio C Hamanoa76cb0d2008-08-13 20:04:101293</p>
1294</li>
1295<li>
1296<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531297<code>cpp</code> suitable for source code in the C and C++ languages.
Junio C Hamano20d47e32009-01-26 06:36:021298</p>
1299</li>
1300<li>
1301<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531302<code>csharp</code> suitable for source code in the C# language.
Junio C Hamano53ba6d02010-08-22 07:25:121303</p>
1304</li>
1305<li>
1306<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531307<code>fortran</code> suitable for source code in the Fortran language.
Junio C Hamano3b4609d2010-09-30 00:04:341308</p>
1309</li>
1310<li>
1311<p>
Junio C Hamanod7ed4042015-08-03 19:43:001312<code>fountain</code> suitable for Fountain documents.
1313</p>
1314</li>
1315<li>
1316<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531317<code>html</code> suitable for HTML/XHTML documents.
Junio C Hamanof24b8062008-09-09 01:34:391318</p>
1319</li>
1320<li>
1321<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531322<code>java</code> suitable for source code in the Java language.
Junio C Hamanoa76cb0d2008-08-13 20:04:101323</p>
1324</li>
1325<li>
1326<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531327<code>matlab</code> suitable for source code in the MATLAB language.
Junio C Hamano92887a32011-12-07 00:26:291328</p>
1329</li>
1330<li>
1331<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531332<code>objc</code> suitable for source code in the Objective-C language.
Junio C Hamanoa476efa2008-10-10 15:31:421333</p>
1334</li>
1335<li>
1336<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531337<code>pascal</code> suitable for source code in the Pascal/Delphi language.
Junio C Hamanoa76cb0d2008-08-13 20:04:101338</p>
1339</li>
1340<li>
1341<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531342<code>perl</code> suitable for source code in the Perl language.
Junio C Hamano9b6fafe2011-01-14 00:43:221343</p>
1344</li>
1345<li>
1346<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531347<code>php</code> suitable for source code in the PHP language.
Junio C Hamanof24b8062008-09-09 01:34:391348</p>
1349</li>
1350<li>
1351<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531352<code>python</code> suitable for source code in the Python language.
Junio C Hamano3f2f6e52008-08-21 10:34:221353</p>
1354</li>
1355<li>
1356<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531357<code>ruby</code> suitable for source code in the Ruby language.
Junio C Hamanoa76cb0d2008-08-13 20:04:101358</p>
1359</li>
1360<li>
1361<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531362<code>tex</code> suitable for source code for LaTeX documents.
Junio C Hamanoa76cb0d2008-08-13 20:04:101363</p>
1364</li>
1365</ul></div>
Junio C Hamano9d971152012-12-19 00:43:111366</div>
1367<div class="sect3">
Junio C Hamano20d47e32009-01-26 06:36:021368<h4 id="_customizing_word_diff">Customizing word diff</h4>
Junio C Hamanoc14e6ad2014-10-31 20:25:531369<div class="paragraph"><p>You can customize the rules that <code>git diff --word-diff</code> uses to
Junio C Hamano20d47e32009-01-26 06:36:021370split words in a line, by specifying an appropriate regular expression
1371in the "diff.*.wordRegex" configuration variable. For example, in TeX
1372a backslash followed by a sequence of letters forms a command, but
1373several such commands can be run together without intervening
Junio C Hamano3bd66e92009-04-18 06:17:561374whitespace. To separate them, use a regular expression in your
Junio C Hamanoc14e6ad2014-10-31 20:25:531375<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p></div>
Junio C Hamano20d47e32009-01-26 06:36:021376<div class="listingblock">
1377<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531378<pre><code>[diff "tex"]
1379 wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"</code></pre>
Junio C Hamano20d47e32009-01-26 06:36:021380</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581381<div class="paragraph"><p>A built-in pattern is provided for all languages listed in the
Junio C Hamano20d47e32009-01-26 06:36:021382previous section.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111383</div>
1384<div class="sect3">
Junio C Hamano28363492008-11-14 08:26:311385<h4 id="_performing_text_diffs_of_binary_files">Performing text diffs of binary files</h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581386<div class="paragraph"><p>Sometimes it is desirable to see the diff of a text-converted
Junio C Hamano28363492008-11-14 08:26:311387version of some binary files. For example, a word processor
1388document can be converted to an ASCII text representation, and
1389the diff of the text shown. Even though this conversion loses
1390some information, the resulting diff is useful for human
1391viewing (but cannot be applied directly).</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531392<div class="paragraph"><p>The <code>textconv</code> config option is used to define a program for
Junio C Hamano28363492008-11-14 08:26:311393performing such a conversion. The program should take a single
1394argument, the name of a file to convert, and produce the
1395resulting text on stdout.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581396<div class="paragraph"><p>For example, to show the diff of the exif information of a
Junio C Hamano28363492008-11-14 08:26:311397file instead of the binary information (assuming you have the
Junio C Hamano3bd66e92009-04-18 06:17:561398exif tool installed), add the following section to your
Junio C Hamanoc14e6ad2014-10-31 20:25:531399<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file):</p></div>
Junio C Hamano28363492008-11-14 08:26:311400<div class="listingblock">
1401<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531402<pre><code>[diff "jpg"]
1403 textconv = exif</code></pre>
Junio C Hamano28363492008-11-14 08:26:311404</div></div>
1405<div class="admonitionblock">
1406<table><tr>
1407<td class="icon">
1408<div class="title">Note</div>
1409</td>
1410<td class="content">The text conversion is generally a one-way conversion;
1411in this example, we lose the actual image contents and focus
1412just on the text data. This means that diffs generated by
Junio C Hamanoeef01fe2010-12-13 08:31:581413textconv are <em>not</em> suitable for applying. For this reason,
Junio C Hamanoc14e6ad2014-10-31 20:25:531414only <code>git diff</code> and the <code>git log</code> family of commands (i.e.,
1415log, whatchanged, show) will perform text conversion. <code>git
1416format-patch</code> will never generate this output. If you want to
Junio C Hamano28363492008-11-14 08:26:311417send somebody a text-converted diff of a binary file (e.g.,
1418because it quickly conveys the changes you have made), you
Junio C Hamanoeef01fe2010-12-13 08:31:581419should generate it separately and send it as a comment <em>in
1420addition to</em> the usual binary diff that you might send.</td>
Junio C Hamano28363492008-11-14 08:26:311421</tr></table>
1422</div>
Junio C Hamanoeef01fe2010-12-13 08:31:581423<div class="paragraph"><p>Because text conversion can be slow, especially when doing a
Junio C Hamanoc14e6ad2014-10-31 20:25:531424large number of them with <code>git log -p</code>, Git provides a mechanism
Junio C Hamanocb39aea2010-05-09 07:24:481425to cache the output and use it in future diffs. To enable
Junio C Hamanoeef01fe2010-12-13 08:31:581426caching, set the "cachetextconv" variable in your diff driver&#8217;s
Junio C Hamanocb39aea2010-05-09 07:24:481427config. For example:</p></div>
1428<div class="listingblock">
1429<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531430<pre><code>[diff "jpg"]
Junio C Hamanocb39aea2010-05-09 07:24:481431 textconv = exif
Junio C Hamanoc14e6ad2014-10-31 20:25:531432 cachetextconv = true</code></pre>
Junio C Hamanocb39aea2010-05-09 07:24:481433</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581434<div class="paragraph"><p>This will cache the result of running "exif" on each blob
Junio C Hamanocb39aea2010-05-09 07:24:481435indefinitely. If you change the textconv config variable for a
Junio C Hamano076ffcc2013-02-06 05:13:211436diff driver, Git will automatically invalidate the cache entries
Junio C Hamanocb39aea2010-05-09 07:24:481437and re-run the textconv filter. If you want to invalidate the
1438cache manually (e.g., because your version of "exif" was updated
1439and now produces better output), you can remove the cache
Junio C Hamanoc14e6ad2014-10-31 20:25:531440manually with <code>git update-ref -d refs/notes/textconv/jpg</code> (where
Junio C Hamanocb39aea2010-05-09 07:24:481441"jpg" is the name of the diff driver, as in the example above).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111442</div>
1443<div class="sect3">
Junio C Hamanof93530e2011-05-25 23:59:591444<h4 id="_choosing_textconv_versus_external_diff">Choosing textconv versus external diff</h4>
1445<div class="paragraph"><p>If you want to show differences between binary or specially-formatted
1446blobs in your repository, you can choose to use either an external diff
1447command, or to use textconv to convert them to a diff-able text format.
1448Which method you choose depends on your exact situation.</p></div>
1449<div class="paragraph"><p>The advantage of using an external diff command is flexibility. You are
1450not bound to find line-oriented changes, nor is it necessary for the
1451output to resemble unified diff. You are free to locate and report
1452changes in the most appropriate way for your data format.</p></div>
1453<div class="paragraph"><p>A textconv, by comparison, is much more limiting. You provide a
Junio C Hamano076ffcc2013-02-06 05:13:211454transformation of the data into a line-oriented text format, and Git
Junio C Hamanof93530e2011-05-25 23:59:591455uses its regular diff tools to generate the output. There are several
1456advantages to choosing this method:</p></div>
1457<div class="olist arabic"><ol class="arabic">
1458<li>
1459<p>
1460Ease of use. It is often much simpler to write a binary to text
1461 transformation than it is to perform your own diff. In many cases,
1462 existing programs can be used as textconv filters (e.g., exif,
1463 odt2txt).
1464</p>
1465</li>
1466<li>
1467<p>
1468Git diff features. By performing only the transformation step
Junio C Hamano076ffcc2013-02-06 05:13:211469 yourself, you can still utilize many of Git&#8217;s diff features,
Junio C Hamanof93530e2011-05-25 23:59:591470 including colorization, word-diff, and combined diffs for merges.
1471</p>
1472</li>
1473<li>
1474<p>
1475Caching. Textconv caching can speed up repeated diffs, such as those
Junio C Hamanoc14e6ad2014-10-31 20:25:531476 you might trigger by running <code>git log -p</code>.
Junio C Hamanof93530e2011-05-25 23:59:591477</p>
1478</li>
1479</ol></div>
Junio C Hamano9d971152012-12-19 00:43:111480</div>
1481<div class="sect3">
Junio C Hamano9b6fafe2011-01-14 00:43:221482<h4 id="_marking_files_as_binary">Marking files as binary</h4>
1483<div class="paragraph"><p>Git usually guesses correctly whether a blob contains text or binary
1484data by examining the beginning of the contents. However, sometimes you
1485may want to override its decision, either because a blob contains binary
1486data later in the file, or because the content, while technically
1487composed of text characters, is opaque to a human reader. For example,
Junio C Hamanofb5ffde2014-11-04 22:38:561488many postscript files contain only ASCII characters, but produce noisy
Junio C Hamano9b6fafe2011-01-14 00:43:221489and meaningless diffs.</p></div>
1490<div class="paragraph"><p>The simplest way to mark a file as binary is to unset the diff
Junio C Hamanoc14e6ad2014-10-31 20:25:531491attribute in the <code>.gitattributes</code> file:</p></div>
Junio C Hamano9b6fafe2011-01-14 00:43:221492<div class="listingblock">
1493<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531494<pre><code>*.ps -diff</code></pre>
Junio C Hamano9b6fafe2011-01-14 00:43:221495</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531496<div class="paragraph"><p>This will cause Git to generate <code>Binary files differ</code> (or a binary
Junio C Hamano9b6fafe2011-01-14 00:43:221497patch, if binary patches are enabled) instead of a regular diff.</p></div>
1498<div class="paragraph"><p>However, one may also want to specify other diff driver attributes. For
Junio C Hamanoc14e6ad2014-10-31 20:25:531499example, you might want to use <code>textconv</code> to convert postscript files to
Junio C Hamanofb5ffde2014-11-04 22:38:561500an ASCII representation for human viewing, but otherwise treat them as
Junio C Hamanoc14e6ad2014-10-31 20:25:531501binary files. You cannot specify both <code>-diff</code> and <code>diff=ps</code> attributes.
1502The solution is to use the <code>diff.*.binary</code> config option:</p></div>
Junio C Hamano9b6fafe2011-01-14 00:43:221503<div class="listingblock">
1504<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531505<pre><code>[diff "ps"]
Junio C Hamano9b6fafe2011-01-14 00:43:221506 textconv = ps2ascii
Junio C Hamanoc14e6ad2014-10-31 20:25:531507 binary = true</code></pre>
Junio C Hamano9b6fafe2011-01-14 00:43:221508</div></div>
Junio C Hamano9d971152012-12-19 00:43:111509</div>
1510</div>
1511<div class="sect2">
1512<h3 id="_performing_a_three_way_merge">Performing a three-way merge</h3>
1513<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531514<h4 id="_code_merge_code"><code>merge</code></h4>
1515<div class="paragraph"><p>The attribute <code>merge</code> affects how three versions of a file are
1516merged when a file-level merge is necessary during <code>git merge</code>,
1517and other commands such as <code>git revert</code> and <code>git cherry-pick</code>.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581518<div class="dlist"><dl>
1519<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131520Set
1521</dt>
1522<dd>
1523<p>
1524 Built-in 3-way merge driver is used to merge the
Junio C Hamanoc14e6ad2014-10-31 20:25:531525 contents in a way similar to <em>merge</em> command of <code>RCS</code>
Junio C Hamanoe90436a2007-04-22 07:22:131526 suite. This is suitable for ordinary text files.
1527</p>
1528</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581529<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131530Unset
1531</dt>
1532<dd>
1533<p>
1534 Take the version from the current branch as the
1535 tentative merge result, and declare that the merge has
Junio C Hamanofa28cb12011-03-19 01:35:351536 conflicts. This is suitable for binary files that do
Junio C Hamanoe90436a2007-04-22 07:22:131537 not have a well-defined merge semantics.
1538</p>
1539</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581540<dt class="hdlist1">
Junio C Hamanoe90436a2007-04-22 07:22:131541Unspecified
1542</dt>
1543<dd>
1544<p>
1545 By default, this uses the same built-in 3-way merge
Junio C Hamanoc14e6ad2014-10-31 20:25:531546 driver as is the case when the <code>merge</code> attribute is set.
1547 However, the <code>merge.default</code> configuration variable can name
Junio C Hamanofa28cb12011-03-19 01:35:351548 different merge driver to be used with paths for which the
Junio C Hamanoc14e6ad2014-10-31 20:25:531549 <code>merge</code> attribute is unspecified.
Junio C Hamanoe90436a2007-04-22 07:22:131550</p>
1551</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581552<dt class="hdlist1">
Junio C Hamano9db95ca2007-04-23 07:27:051553String
Junio C Hamanoe90436a2007-04-22 07:22:131554</dt>
1555<dd>
1556<p>
1557 3-way merge is performed using the specified custom
1558 merge driver. The built-in 3-way merge driver can be
1559 explicitly specified by asking for "text" driver; the
1560 built-in "take the current branch" driver can be
Junio C Hamano22572e72007-04-25 05:59:251561 requested with "binary".
Junio C Hamanoe90436a2007-04-22 07:22:131562</p>
1563</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311564</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111565</div>
1566<div class="sect3">
Junio C Hamanoba4b9282008-07-06 05:20:311567<h4 id="_built_in_merge_drivers">Built-in merge drivers</h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581568<div class="paragraph"><p>There are a few built-in low-level merge drivers defined that
Junio C Hamanoc14e6ad2014-10-31 20:25:531569can be asked for via the <code>merge</code> attribute.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581570<div class="dlist"><dl>
1571<dt class="hdlist1">
Junio C Hamanof556fc22007-12-23 08:16:381572text
1573</dt>
1574<dd>
1575<p>
1576 Usual 3-way file level merge for text files. Conflicted
Junio C Hamanoc14e6ad2014-10-31 20:25:531577 regions are marked with conflict markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>,
1578 <code>=======</code> and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code>. The version from your branch
1579 appears before the <code>=======</code> marker, and the version
1580 from the merged branch appears after the <code>=======</code>
Junio C Hamanof556fc22007-12-23 08:16:381581 marker.
1582</p>
1583</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581584<dt class="hdlist1">
Junio C Hamanof556fc22007-12-23 08:16:381585binary
1586</dt>
1587<dd>
1588<p>
1589 Keep the version from your branch in the work tree, but
1590 leave the path in the conflicted state for the user to
1591 sort out.
1592</p>
1593</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581594<dt class="hdlist1">
Junio C Hamanof556fc22007-12-23 08:16:381595union
1596</dt>
1597<dd>
1598<p>
1599 Run 3-way file level merge for text files, but take
1600 lines from both versions, instead of leaving conflict
1601 markers. This tends to leave the added lines in the
1602 resulting file in random order and the user should
1603 verify the result. Do not use this if you do not
1604 understand the implications.
1605</p>
1606</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311607</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111608</div>
1609<div class="sect3">
Junio C Hamanoba4b9282008-07-06 05:20:311610<h4 id="_defining_a_custom_merge_driver">Defining a custom merge driver</h4>
Junio C Hamanoc14e6ad2014-10-31 20:25:531611<div class="paragraph"><p>The definition of a merge driver is done in the <code>.git/config</code>
1612file, not in the <code>gitattributes</code> file, so strictly speaking this
Junio C Hamanoba4b9282008-07-06 05:20:311613manual page is a wrong place to talk about it. However&#8230;</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531614<div class="paragraph"><p>To define a custom merge driver <code>filfre</code>, add a section to your
1615<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:131616<div class="listingblock">
1617<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531618<pre><code>[merge "filfre"]
Junio C Hamanoe90436a2007-04-22 07:22:131619 name = feel-free merge driver
Junio C Hamanodf5384b2015-06-24 21:12:121620 driver = filfre %O %A %B %L %P
Junio C Hamanoc14e6ad2014-10-31 20:25:531621 recursive = binary</code></pre>
Junio C Hamanoe90436a2007-04-22 07:22:131622</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531623<div class="paragraph"><p>The <code>merge.*.name</code> variable gives the driver a human-readable
Junio C Hamanoba4b9282008-07-06 05:20:311624name.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581625<div class="paragraph"><p>The &#8216;merge.*.driver` variable&#8217;s value is used to construct a
Junio C Hamanoc14e6ad2014-10-31 20:25:531626command to run to merge ancestor&#8217;s version (<code>%O</code>), current
1627version (<code>%A</code>) and the other branches&#8217; version (<code>%B</code>). These
Junio C Hamanoe90436a2007-04-22 07:22:131628three tokens are replaced with the names of temporary files that
1629hold the contents of these versions when the command line is
Junio C Hamano86660db2010-02-24 01:12:541630built. Additionally, %L will be replaced with the conflict marker
1631size (see below).</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581632<div class="paragraph"><p>The merge driver is expected to leave the result of the merge in
Junio C Hamanoc14e6ad2014-10-31 20:25:531633the file named with <code>%A</code> by overwriting it, and exit with zero
Junio C Hamanoe90436a2007-04-22 07:22:131634status if it managed to merge them cleanly, or non-zero if there
Junio C Hamanoba4b9282008-07-06 05:20:311635were conflicts.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531636<div class="paragraph"><p>The <code>merge.*.recursive</code> variable specifies what other merge
Junio C Hamanoe90436a2007-04-22 07:22:131637driver to use when the merge driver is called for an internal
1638merge between common ancestors, when there are more than one.
1639When left unspecified, the driver itself is used for both
Junio C Hamanoba4b9282008-07-06 05:20:311640internal merge and the final merge.</p></div>
Junio C Hamanodf5384b2015-06-24 21:12:121641<div class="paragraph"><p>The merge driver can learn the pathname in which the merged result
1642will be stored via placeholder <code>%P</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111643</div>
1644<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531645<h4 id="_code_conflict_marker_size_code"><code>conflict-marker-size</code></h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581646<div class="paragraph"><p>This attribute controls the length of conflict markers left in
Junio C Hamano1aa40d22010-01-21 17:46:431647the work tree file during a conflicted merge. Only setting to
1648the value to a positive integer has any meaningful effect.</p></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531649<div class="paragraph"><p>For example, this line in <code>.gitattributes</code> can be used to tell the merge
Junio C Hamano1aa40d22010-01-21 17:46:431650machinery to leave much longer (instead of the usual 7-character-long)
Junio C Hamanoc14e6ad2014-10-31 20:25:531651conflict markers when merging the file <code>Documentation/git-merge.txt</code>
Junio C Hamano1aa40d22010-01-21 17:46:431652results in a conflict.</p></div>
1653<div class="listingblock">
1654<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531655<pre><code>Documentation/git-merge.txt conflict-marker-size=32</code></pre>
Junio C Hamano1aa40d22010-01-21 17:46:431656</div></div>
Junio C Hamano9d971152012-12-19 00:43:111657</div>
1658</div>
1659<div class="sect2">
1660<h3 id="_checking_whitespace_errors">Checking whitespace errors</h3>
1661<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531662<h4 id="_code_whitespace_code"><code>whitespace</code></h4>
1663<div class="paragraph"><p>The <code>core.whitespace</code> configuration variable allows you to define what
Junio C Hamanoba4b9282008-07-06 05:20:311664<em>diff</em> and <em>apply</em> should consider whitespace errors for all paths in
Junio C Hamanoa28a9202012-06-21 07:08:231665the project (See <a href="git-config.html">git-config(1)</a>). This attribute gives you finer
Junio C Hamanoba4b9282008-07-06 05:20:311666control per path.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581667<div class="dlist"><dl>
1668<dt class="hdlist1">
Junio C Hamano942b35e2007-12-09 10:19:331669Set
1670</dt>
1671<dd>
1672<p>
Junio C Hamano076ffcc2013-02-06 05:13:211673 Notice all types of potential whitespace errors known to Git.
Junio C Hamanoc14e6ad2014-10-31 20:25:531674 The tab width is taken from the value of the <code>core.whitespace</code>
Junio C Hamanoeef01fe2010-12-13 08:31:581675 configuration variable.
Junio C Hamano942b35e2007-12-09 10:19:331676</p>
1677</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581678<dt class="hdlist1">
Junio C Hamano942b35e2007-12-09 10:19:331679Unset
1680</dt>
1681<dd>
1682<p>
1683 Do not notice anything as error.
1684</p>
1685</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581686<dt class="hdlist1">
Junio C Hamano942b35e2007-12-09 10:19:331687Unspecified
1688</dt>
1689<dd>
1690<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531691 Use the value of the <code>core.whitespace</code> configuration variable to
Junio C Hamano942b35e2007-12-09 10:19:331692 decide what to notice as error.
1693</p>
1694</dd>
Junio C Hamanoeef01fe2010-12-13 08:31:581695<dt class="hdlist1">
Junio C Hamano942b35e2007-12-09 10:19:331696String
1697</dt>
1698<dd>
1699<p>
1700 Specify a comma separate list of common whitespace problems to
Junio C Hamanoc14e6ad2014-10-31 20:25:531701 notice in the same format as the <code>core.whitespace</code> configuration
Junio C Hamano942b35e2007-12-09 10:19:331702 variable.
1703</p>
1704</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311705</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111706</div>
1707</div>
1708<div class="sect2">
1709<h3 id="_creating_an_archive">Creating an archive</h3>
1710<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531711<h4 id="_code_export_ignore_code"><code>export-ignore</code></h4>
1712<div class="paragraph"><p>Files and directories with the attribute <code>export-ignore</code> won&#8217;t be added to
Junio C Hamanoba4b9282008-07-06 05:20:311713archive files.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111714</div>
1715<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531716<h4 id="_code_export_subst_code"><code>export-subst</code></h4>
1717<div class="paragraph"><p>If the attribute <code>export-subst</code> is set for a file then Git will expand
Junio C Hamanoba4b9282008-07-06 05:20:311718several placeholders when adding this file to an archive. The
1719expansion depends on the availability of a commit ID, i.e., if
Junio C Hamanoa28a9202012-06-21 07:08:231720<a href="git-archive.html">git-archive(1)</a> has been given a tree instead of a commit or a
Junio C Hamanoba4b9282008-07-06 05:20:311721tag then no replacement will be done. The placeholders are the same
Junio C Hamanoc14e6ad2014-10-31 20:25:531722as those for the option <code>--pretty=format:</code> of <a href="git-log.html">git-log(1)</a>,
1723except that they need to be wrapped like this: <code>$Format:PLACEHOLDERS$</code>
1724in the file. E.g. the string <code>$Format:%H$</code> will be replaced by the
Junio C Hamanoba4b9282008-07-06 05:20:311725commit hash.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111726</div>
1727</div>
1728<div class="sect2">
1729<h3 id="_packing_objects">Packing objects</h3>
1730<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531731<h4 id="_code_delta_code"><code>delta</code></h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581732<div class="paragraph"><p>Delta compression will not be attempted for blobs for paths with the
Junio C Hamanoc14e6ad2014-10-31 20:25:531733attribute <code>delta</code> set to false.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111734</div>
1735</div>
1736<div class="sect2">
1737<h3 id="_viewing_files_in_gui_tools">Viewing files in GUI tools</h3>
1738<div class="sect3">
Junio C Hamanoc14e6ad2014-10-31 20:25:531739<h4 id="_code_encoding_code"><code>encoding</code></h4>
Junio C Hamanoeef01fe2010-12-13 08:31:581740<div class="paragraph"><p>The value of this attribute specifies the character encoding that should
Junio C Hamanoa28a9202012-06-21 07:08:231741be used by GUI tools (e.g. <a href="gitk.html">gitk(1)</a> and <a href="git-gui.html">git-gui(1)</a>) to
Junio C Hamanod3452a02008-11-15 08:07:551742display the contents of the relevant file. Note that due to performance
Junio C Hamanoa28a9202012-06-21 07:08:231743considerations <a href="gitk.html">gitk(1)</a> does not use this attribute unless you
Junio C Hamanod3452a02008-11-15 08:07:551744manually enable per-file encodings in its options.</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581745<div class="paragraph"><p>If this attribute is not set or has an invalid value, the value of the
Junio C Hamanoc14e6ad2014-10-31 20:25:531746<code>gui.encoding</code> configuration variable is used instead
Junio C Hamanoa28a9202012-06-21 07:08:231747(See <a href="git-config.html">git-config(1)</a>).</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:131748</div>
Junio C Hamano9d971152012-12-19 00:43:111749</div>
1750</div>
1751</div>
1752<div class="sect1">
Junio C Hamano86d84362011-08-04 00:21:511753<h2 id="_using_macro_attributes">USING MACRO ATTRIBUTES</h2>
Junio C Hamanofcb740a2008-08-31 06:32:051754<div class="sectionbody">
Junio C Hamanoeef01fe2010-12-13 08:31:581755<div class="paragraph"><p>You do not want any end-of-line conversions applied to, nor textual diffs
Junio C Hamanofcb740a2008-08-31 06:32:051756produced for, any binary file you track. You would need to specify e.g.</p></div>
1757<div class="listingblock">
1758<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531759<pre><code>*.jpg -text -diff</code></pre>
Junio C Hamanofcb740a2008-08-31 06:32:051760</div></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581761<div class="paragraph"><p>but that may become cumbersome, when you have many attributes. Using
Junio C Hamano86d84362011-08-04 00:21:511762macro attributes, you can define an attribute that, when set, also
1763sets or unsets a number of other attributes at the same time. The
Junio C Hamanoc14e6ad2014-10-31 20:25:531764system knows a built-in macro attribute, <code>binary</code>:</p></div>
Junio C Hamanofcb740a2008-08-31 06:32:051765<div class="listingblock">
1766<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531767<pre><code>*.jpg binary</code></pre>
Junio C Hamanofcb740a2008-08-31 06:32:051768</div></div>
Junio C Hamano86d84362011-08-04 00:21:511769<div class="paragraph"><p>Setting the "binary" attribute also unsets the "text" and "diff"
1770attributes as above. Note that macro attributes can only be "Set",
1771though setting one might have the effect of setting or unsetting other
1772attributes or even returning other attributes to the "Unspecified"
1773state.</p></div>
Junio C Hamanofcb740a2008-08-31 06:32:051774</div>
Junio C Hamano9d971152012-12-19 00:43:111775</div>
1776<div class="sect1">
Junio C Hamano86d84362011-08-04 00:21:511777<h2 id="_defining_macro_attributes">DEFINING MACRO ATTRIBUTES</h2>
Junio C Hamanofcb740a2008-08-31 06:32:051778<div class="sectionbody">
Junio C Hamanoc5bd79e2014-01-27 21:31:261779<div class="paragraph"><p>Custom macro attributes can be defined only in top-level gitattributes
Junio C Hamanoc14e6ad2014-10-31 20:25:531780files (<code>$GIT_DIR/info/attributes</code>, the <code>.gitattributes</code> file at the
Junio C Hamanoc5bd79e2014-01-27 21:31:261781top level of the working tree, or the global or system-wide
Junio C Hamanoc14e6ad2014-10-31 20:25:531782gitattributes files), not in <code>.gitattributes</code> files in working tree
Junio C Hamanoc5bd79e2014-01-27 21:31:261783subdirectories. The built-in macro attribute "binary" is equivalent
1784to:</p></div>
Junio C Hamanofcb740a2008-08-31 06:32:051785<div class="listingblock">
1786<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531787<pre><code>[attr]binary -diff -merge -text</code></pre>
Junio C Hamanofcb740a2008-08-31 06:32:051788</div></div>
1789</div>
Junio C Hamano9d971152012-12-19 00:43:111790</div>
1791<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311792<h2 id="_example">EXAMPLE</h2>
Junio C Hamanoe90436a2007-04-22 07:22:131793<div class="sectionbody">
Junio C Hamanoc14e6ad2014-10-31 20:25:531794<div class="paragraph"><p>If you have these three <code>gitattributes</code> file:</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:131795<div class="listingblock">
1796<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531797<pre><code>(in $GIT_DIR/info/attributes)
Junio C Hamanoe90436a2007-04-22 07:22:131798
1799a* foo !bar -baz
1800
1801(in .gitattributes)
1802abc foo bar baz
1803
1804(in t/.gitattributes)
1805ab* merge=filfre
1806abc -foo -bar
Junio C Hamanoc14e6ad2014-10-31 20:25:531807*.c frotz</code></pre>
Junio C Hamanoe90436a2007-04-22 07:22:131808</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531809<div class="paragraph"><p>the attributes given to path <code>t/abc</code> are computed as follows:</p></div>
Junio C Hamanoeef01fe2010-12-13 08:31:581810<div class="olist arabic"><ol class="arabic">
Junio C Hamanoe90436a2007-04-22 07:22:131811<li>
1812<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531813By examining <code>t/.gitattributes</code> (which is in the same
Junio C Hamano076ffcc2013-02-06 05:13:211814 directory as the path in question), Git finds that the first
Junio C Hamanoc14e6ad2014-10-31 20:25:531815 line matches. <code>merge</code> attribute is set. It also finds that
1816 the second line matches, and attributes <code>foo</code> and <code>bar</code>
Junio C Hamanoe90436a2007-04-22 07:22:131817 are unset.
1818</p>
1819</li>
1820<li>
1821<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531822Then it examines <code>.gitattributes</code> (which is in the parent
Junio C Hamanoe90436a2007-04-22 07:22:131823 directory), and finds that the first line matches, but
Junio C Hamanoc14e6ad2014-10-31 20:25:531824 <code>t/.gitattributes</code> file already decided how <code>merge</code>, <code>foo</code>
1825 and <code>bar</code> attributes should be given to this path, so it
1826 leaves <code>foo</code> and <code>bar</code> unset. Attribute <code>baz</code> is set.
Junio C Hamanoe90436a2007-04-22 07:22:131827</p>
1828</li>
1829<li>
1830<p>
Junio C Hamanoc14e6ad2014-10-31 20:25:531831Finally it examines <code>$GIT_DIR/info/attributes</code>. This file
Junio C Hamanoe90436a2007-04-22 07:22:131832 is used to override the in-tree settings. The first line is
Junio C Hamanoc14e6ad2014-10-31 20:25:531833 a match, and <code>foo</code> is set, <code>bar</code> is reverted to unspecified
1834 state, and <code>baz</code> is unset.
Junio C Hamanoe90436a2007-04-22 07:22:131835</p>
1836</li>
Junio C Hamanoba4b9282008-07-06 05:20:311837</ol></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:531838<div class="paragraph"><p>As the result, the attributes assignment to <code>t/abc</code> becomes:</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:131839<div class="listingblock">
1840<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531841<pre><code>foo set to true
Junio C Hamanoe90436a2007-04-22 07:22:131842bar unspecified
1843baz set to false
1844merge set to string value "filfre"
Junio C Hamanoc14e6ad2014-10-31 20:25:531845frotz unspecified</code></pre>
Junio C Hamanoe90436a2007-04-22 07:22:131846</div></div>
1847</div>
Junio C Hamano9d971152012-12-19 00:43:111848</div>
1849<div class="sect1">
Junio C Hamanof7279012011-08-18 06:13:131850<h2 id="_see_also">SEE ALSO</h2>
1851<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231852<div class="paragraph"><p><a href="git-check-attr.html">git-check-attr(1)</a>.</p></div>
Junio C Hamanof7279012011-08-18 06:13:131853</div>
Junio C Hamano9d971152012-12-19 00:43:111854</div>
1855<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311856<h2 id="_git">GIT</h2>
Junio C Hamanoe90436a2007-04-22 07:22:131857<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231858<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamanoe90436a2007-04-22 07:22:131859</div>
Junio C Hamano7bd050f2011-09-22 06:32:221860</div>
Junio C Hamano9d971152012-12-19 00:43:111861</div>
Junio C Hamano7bd050f2011-09-22 06:32:221862<div id="footnotes"><hr /></div>
Junio C Hamanoe90436a2007-04-22 07:22:131863<div id="footer">
1864<div id="footer-text">
Junio C Hamanod7ed4042015-08-03 19:43:001865Last updated 2015-08-03 12:41:59 PDT
Junio C Hamanoe90436a2007-04-22 07:22:131866</div>
1867</div>
1868</body>
1869</html>