Mini Shell
Direktori : /usr/share/doc/git/ |
|
Current File : //usr/share/doc/git/gitattributes.html |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="generator" content="Asciidoctor 2.0.12"/>
<title>gitattributes(5)</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"/>
<style>
/* Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
/* Uncomment @import statement to use as custom stylesheet */
/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}
audio,video{display:inline-block}
audio:not([controls]){display:none;height:0}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
a{background:none}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
abbr[title]{border-bottom:1px dotted}
b,strong{font-weight:bold}
dfn{font-style:italic}
hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,*::before,*::after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
img,object,svg{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:0}
p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
ul.square{list-style-type:square}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
abbr{text-transform:none}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
blockquote cite::before{content:"\2014 \0020"}
blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}
table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede;word-wrap:normal}
table thead,table tfoot{background:#f7f8f7}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt{background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.center{margin-left:auto;margin-right:auto}
.stretch{width:100%}
.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
.clearfix::after,.float-group::after{clear:both}
:not(pre).nobreak{word-wrap:normal}
:not(pre).nowrap{white-space:nowrap}
:not(pre).pre-wrap{white-space:pre-wrap}
:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
pre>code{display:block}
pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
em em{font-style:normal}
strong strong{font-weight:400}
.keyseq{color:rgba(51,51,51,.8)}
kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menuref{color:#000}
.menuseq b:not(.caret),.menuref{font-weight:inherit}
.menuseq{word-spacing:-.02em}
.menuseq b.caret{font-size:1.25em;line-height:.8}
.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
b.button::before{content:"[";padding:0 3px 0 2px}
b.button::after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
#header::after,#content::after,#footnotes::after,#footer::after{clear:both}
#content{margin-top:1.25em}
#content::before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span::before{content:"\00a0\2013\00a0"}
#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark::before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber::after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc li{line-height:1.3334;margin-top:.3334em}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}
#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
#content{margin-bottom:.625em}
.sect1{padding-bottom:.625em}
@media screen and (min-width:768px){#content{margin-bottom:1.25em}
.sect1{padding-bottom:1.25em}}
.sect1:last-child{padding-bottom:0}
.sect1+.sect1{border-top:1px solid #e7e7e9}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
details>summary:first-of-type{cursor:pointer;display:list-item;outline:none;margin-bottom:.75em}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
.paragraph.lead>p,#preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:inherit}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
.exampleblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child{margin-bottom:0}
.sidebarblock{border-style:solid;border-width:1px;border-color:#dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;-webkit-border-radius:4px;border-radius:4px}
.sidebarblock>:first-child{margin-top:0}
.sidebarblock>:last-child{margin-bottom:0}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock>.content>pre{-webkit-border-radius:4px;border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class="highlight"],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
.listingblock>.content{position:relative}
.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
.listingblock:hover code[data-lang]::before{display:block}
.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.prettyprint{background:#f7f7f8}
pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
pre.prettyprint li code[data-lang]::before{opacity:1}
pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
table.linenotable td.code{padding-left:.75em}
table.linenotable td.linenos{border-right:1px solid currentColor;opacity:.35;padding-right:.5em}
pre.pygments .lineno{border-right:1px solid currentColor;opacity:.35;display:inline-block;margin-right:.75em}
pre.pygments .lineno::before{content:"";margin-right:-.125em}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
.verseblock{margin:0 1em 1.25em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
.quoteblock.abstract{margin:0 1em 1.25em;display:block}
.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;text-align:left;margin-right:0}
p.tableblock:last-child{margin-bottom:0}
td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}
td.tableblock>.content>:last-child{margin-bottom:-1.25em}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all>*>tr>*{border-width:1px}
table.grid-cols>*>tr>*{border-width:0 1px}
table.grid-rows>*>tr>*{border-width:1px 0}
table.frame-all{border-width:1px}
table.frame-ends{border-width:1px 0}
table.frame-sides{border-width:0 1px}
table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}
table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}
table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}
table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}
table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd),table.stripes-even tr:nth-of-type(even),table.stripes-hover tr:hover{background:#f8f8f7}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
ul.unstyled,ol.unstyled{margin-left:0}
ul.checklist{margin-left:.625em}
ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em}
ul.inline{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
ul.inline>li{margin-left:1.25em}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
td.hdlist1{font-weight:bold;padding-bottom:1.25em}
td.hdlist2{word-wrap:anywhere}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
.colist td:not([class]):first-child img{max-width:none}
.colist td:not([class]):last-child{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
.imageblock.left{margin:.25em .625em 1.25em 0}
.imageblock.right{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none;display:inline-block}
a.image object{pointer-events:none}
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
sup.footnote a,sup.footnoteref a{text-decoration:none}
sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
.gist .file-data>table td.line-data{width:99%}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background:#00fafa}
.black{color:#000}
.black-background{background:#000}
.blue{color:#0000bf}
.blue-background{background:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background:#fa00fa}
.gray{color:#606060}
.gray-background{background:#7d7d7d}
.green{color:#006000}
.green-background{background:#007d00}
.lime{color:#00bf00}
.lime-background{background:#00fa00}
.maroon{color:#600000}
.maroon-background{background:#7d0000}
.navy{color:#000060}
.navy-background{background:#00007d}
.olive{color:#606000}
.olive-background{background:#7d7d00}
.purple{color:#600060}
.purple-background{background:#7d007d}
.red{color:#bf0000}
.red-background{background:#fa0000}
.silver{color:#909090}
.silver-background{background:#bcbcbc}
.teal{color:#006060}
.teal-background{background:#007d7d}
.white{color:#bfbfbf}
.white-background{background:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background:#fafa00}
span.icon>.fa{cursor:default}
a span.icon>.fa{cursor:inherit}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);-webkit-border-radius:50%;border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]::after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
h1,h2,p,td.content,span.alt{letter-spacing:-.01em}
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
p,blockquote,dt,td.content,span.alt{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@page{margin:1.25cm .75cm}
@media print{*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]::after{content:" (" attr(title) ")"}
pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
thead{display:table-header-group}
svg{max-width:100%}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#header,#content,#footnotes,#footer{max-width:none}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span::before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]::before{display:block}
#footer{padding:0 .9375em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
@media print,amzn-kf8{#header>h1:first-child{margin-top:1.25rem}
.sect1{padding:0!important}
.sect1+.sect1{border:0}
#footer{background:none}
#footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
</style>
</head>
<body class="manpage">
<div id="header">
<h1>gitattributes(5) Manual Page</h1>
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>gitattributes - Defining attributes per path</p>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p>$GIT_DIR/info/attributes, .gitattributes</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>A <code>gitattributes</code> file is a simple text file that gives
<code>attributes</code> to pathnames.</p>
</div>
<div class="paragraph">
<p>Each line in <code>gitattributes</code> file is of form:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>pattern attr1 attr2 ...</pre>
</div>
</div>
<div class="paragraph">
<p>That is, a pattern followed by an attributes list,
separated by whitespaces. Leading and trailing whitespaces are
ignored. Lines that begin with <em>#</em> are ignored. Patterns
that begin with a double quote are quoted in C style.
When the pattern matches the path in question, the attributes
listed on the line are given to the path.</p>
</div>
<div class="paragraph">
<p>Each attribute can be in one of these states for a given path:</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set</dt>
<dd>
<p>The path has the attribute with special value "true";
this is specified by listing only the name of the
attribute in the attribute list.</p>
</dd>
<dt class="hdlist1">Unset</dt>
<dd>
<p>The path has the attribute with special value "false";
this is specified by listing the name of the attribute
prefixed with a dash <code>-</code> in the attribute list.</p>
</dd>
<dt class="hdlist1">Set to a value</dt>
<dd>
<p>The path has the attribute with specified string value;
this is specified by listing the name of the attribute
followed by an equal sign <code>=</code> and its value in the
attribute list.</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>No pattern matches the path, and nothing says if
the path has or does not have the attribute, the
attribute for the path is said to be Unspecified.</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>When more than one pattern matches the path, a later line
overrides an earlier line. This overriding is done per
attribute.</p>
</div>
<div class="paragraph">
<p>The rules by which the pattern matches paths are the same as in
<code>.gitignore</code> files (see <a href="gitignore.html">gitignore(5)</a>), with a few exceptions:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>negative patterns are forbidden</p>
</li>
<li>
<p>patterns that match a directory do not recursively match paths
inside that directory (so using the trailing-slash <code>path/</code> syntax is
pointless in an attributes file; use <code>path/**</code> instead)</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>When deciding what attributes are assigned to a path, Git
consults <code>$GIT_DIR/info/attributes</code> file (which has the highest
precedence), <code>.gitattributes</code> file in the same directory as the
path in question, and its parent directories up to the toplevel of the
work tree (the further the directory that contains <code>.gitattributes</code>
is from the path in question, the lower its precedence). Finally
global and system-wide files are considered (they have the lowest
precedence).</p>
</div>
<div class="paragraph">
<p>When the <code>.gitattributes</code> file is missing from the work tree, the
path in the index is used as a fall-back. During checkout process,
<code>.gitattributes</code> in the index is used and then the file in the
working tree is used as a fall-back.</p>
</div>
<div class="paragraph">
<p>If you wish to affect only a single repository (i.e., to assign
attributes to files that are particular to
one user’s workflow for that repository), then
attributes should be placed in the <code>$GIT_DIR/info/attributes</code> file.
Attributes which should be version-controlled and distributed to other
repositories (i.e., attributes of interest to all users) should go into
<code>.gitattributes</code> files. Attributes that should affect all repositories
for a single user should be placed in a file specified by the
<code>core.attributesFile</code> configuration option (see <a href="git-config.html">git-config(1)</a>).
Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME
is either not set or empty, $HOME/.config/git/attributes is used instead.
Attributes for all users on a system should be placed in the
<code>$(prefix)/etc/gitattributes</code> file.</p>
</div>
<div class="paragraph">
<p>Sometimes you would need to override a setting of an attribute
for a path to <code>Unspecified</code> state. This can be done by listing
the name of the attribute prefixed with an exclamation point <code>!</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_effects">EFFECTS</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Certain operations by Git can be influenced by assigning
particular attributes to a path. Currently, the following
operations are attributes-aware.</p>
</div>
<div class="sect2">
<h3 id="_checking_out_and_checking_in">Checking-out and checking-in</h3>
<div class="paragraph">
<p>These attributes affect how the contents stored in the
repository are copied to the working tree files when commands
such as <em>git switch</em>, <em>git checkout</em> and <em>git merge</em> run.
They also affect how
Git stores the contents you prepare in the working tree in the
repository upon <em>git add</em> and <em>git commit</em>.</p>
</div>
<div class="sect3">
<h4 id="_text"><code>text</code></h4>
<div class="paragraph">
<p>This attribute marks the path as a text file, which enables end-of-line
conversion: When a matching file is added to the index, the file’s line
endings are normalized to LF in the index. Conversely, when the file is
copied from the index to the working directory, its line endings may be
converted from LF to CRLF depending on the <code>eol</code> attribute, the Git
config, and the platform (see explanation of <code>eol</code> below).</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set</dt>
<dd>
<p>Setting the <code>text</code> attribute on a path enables end-of-line
conversion on checkin and checkout as described above. Line endings
are normalized to LF in the index every time the file is checked in,
even if the file was previously added to Git with CRLF line endings.</p>
</dd>
<dt class="hdlist1">Unset</dt>
<dd>
<p>Unsetting the <code>text</code> attribute on a path tells Git not to
attempt any end-of-line conversion upon checkin or checkout.</p>
</dd>
<dt class="hdlist1">Set to string value "auto"</dt>
<dd>
<p>When <code>text</code> is set to "auto", Git decides by itself whether the file
is text or binary. If it is text and the file was not already in
Git with CRLF endings, line endings are converted on checkin and
checkout as described above. Otherwise, no conversion is done on
checkin or checkout.</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>If the <code>text</code> attribute is unspecified, Git uses the
<code>core.autocrlf</code> configuration variable to determine if the
file should be converted.</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>Any other value causes Git to act as if <code>text</code> has been left
unspecified.</p>
</div>
</div>
<div class="sect3">
<h4 id="_eol"><code>eol</code></h4>
<div class="paragraph">
<p>This attribute marks a path to use a specific line-ending style in the
working tree when it is checked out. It has effect only if <code>text</code> or
<code>text=auto</code> is set (see above), but specifying <code>eol</code> automatically sets
<code>text</code> if <code>text</code> was left unspecified.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set to string value "crlf"</dt>
<dd>
<p>This setting converts the file’s line endings in the working
directory to CRLF when the file is checked out.</p>
</dd>
<dt class="hdlist1">Set to string value "lf"</dt>
<dd>
<p>This setting uses the same line endings in the working directory as
in the index when the file is checked out.</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>If the <code>eol</code> attribute is unspecified for a file, its line endings
in the working directory are determined by the <code>core.autocrlf</code> or
<code>core.eol</code> configuration variable (see the definitions of those
options in <a href="git-config.html">git-config(1)</a>). If <code>text</code> is set but neither of
those variables is, the default is <code>eol=crlf</code> on Windows and
<code>eol=lf</code> on all other platforms.</p>
</dd>
</dl>
</div>
</div>
<div class="sect3">
<h4 id="_backwards_compatibility_with_crlf_attribute">Backwards compatibility with <code>crlf</code> attribute</h4>
<div class="paragraph">
<p>For backwards compatibility, the <code>crlf</code> attribute is interpreted as
follows:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>crlf text
-crlf -text
crlf=input eol=lf</pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_end_of_line_conversion">End-of-line conversion</h4>
<div class="paragraph">
<p>While Git normally leaves file contents alone, it can be configured to
normalize line endings to LF in the repository and, optionally, to
convert them to CRLF when files are checked out.</p>
</div>
<div class="paragraph">
<p>If you simply want to have CRLF line endings in your working directory
regardless of the repository you are working with, you can set the
config variable "core.autocrlf" without using any attributes.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[core]
autocrlf = true</pre>
</div>
</div>
<div class="paragraph">
<p>This does not force normalization of text files, but does ensure
that text files that you introduce to the repository have their line
endings normalized to LF when they are added, and that files that are
already normalized in the repository stay normalized.</p>
</div>
<div class="paragraph">
<p>If you want to ensure that text files that any contributor introduces to
the repository have their line endings normalized, you can set the
<code>text</code> attribute to "auto" for <em>all</em> files.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>* text=auto</pre>
</div>
</div>
<div class="paragraph">
<p>The attributes allow a fine-grained control, how the line endings
are converted.
Here is an example that will make Git normalize .txt, .vcproj and .sh
files, ensure that .vcproj files have CRLF and .sh files have LF in
the working directory, and prevent .jpg files from being normalized
regardless of their content.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>* text=auto
*.txt text
*.vcproj text eol=crlf
*.sh text eol=lf
*.jpg -text</pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
When <code>text=auto</code> conversion is enabled in a cross-platform
project using push and pull to a central repository the text files
containing CRLFs should be normalized.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>From a clean working directory:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ echo "* text=auto" >.gitattributes
$ git add --renormalize .
$ git status # Show files that will be normalized
$ git commit -m "Introduce end-of-line normalization"</pre>
</div>
</div>
<div class="paragraph">
<p>If any files that should not be normalized show up in <em>git status</em>,
unset their <code>text</code> attribute before running <em>git add -u</em>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>manual.pdf -text</pre>
</div>
</div>
<div class="paragraph">
<p>Conversely, text files that Git does not detect can have normalization
enabled manually.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>weirdchars.txt text</pre>
</div>
</div>
<div class="paragraph">
<p>If <code>core.safecrlf</code> is set to "true" or "warn", Git verifies if
the conversion is reversible for the current setting of
<code>core.autocrlf</code>. For "true", Git rejects irreversible
conversions; for "warn", Git only prints a warning but accepts
an irreversible conversion. The safety triggers to prevent such
a conversion done to the files in the work tree, but there are a
few exceptions. Even though…​</p>
</div>
<div class="ulist">
<ul>
<li>
<p><em>git add</em> itself does not touch the files in the work tree, the
next checkout would, so the safety triggers;</p>
</li>
<li>
<p><em>git apply</em> to update a text file with a patch does touch the files
in the work tree, but the operation is about text files and CRLF
conversion is about fixing the line ending inconsistencies, so the
safety does not trigger;</p>
</li>
<li>
<p><em>git diff</em> itself does not touch the files in the work tree, it is
often run to inspect the changes you intend to next <em>git add</em>. To
catch potential problems early, safety triggers.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="_working_tree_encoding"><code>working-tree-encoding</code></h4>
<div class="paragraph">
<p>Git recognizes files encoded in ASCII or one of its supersets (e.g.
UTF-8, ISO-8859-1, …​) as text files. Files encoded in certain other
encodings (e.g. UTF-16) are interpreted as binary and consequently
built-in Git text processing tools (e.g. <em>git diff</em>) as well as most Git
web front ends do not visualize the contents of these files by default.</p>
</div>
<div class="paragraph">
<p>In these cases you can tell Git the encoding of a file in the working
directory with the <code>working-tree-encoding</code> attribute. If a file with this
attribute is added to Git, then Git re-encodes the content from the
specified encoding to UTF-8. Finally, Git stores the UTF-8 encoded
content in its internal data structure (called "the index"). On checkout
the content is re-encoded back to the specified encoding.</p>
</div>
<div class="paragraph">
<p>Please note that using the <code>working-tree-encoding</code> attribute may have a
number of pitfalls:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Alternative Git implementations (e.g. JGit or libgit2) and older Git
versions (as of March 2018) do not support the <code>working-tree-encoding</code>
attribute. If you decide to use the <code>working-tree-encoding</code> attribute
in your repository, then it is strongly recommended to ensure that all
clients working with the repository support it.</p>
<div class="paragraph">
<p>For example, Microsoft Visual Studio resources files (<code>*.rc</code>) or
PowerShell script files (<code>*.ps1</code>) are sometimes encoded in UTF-16.
If you declare <code>*.ps1</code> as files as UTF-16 and you add <code>foo.ps1</code> with
a <code>working-tree-encoding</code> enabled Git client, then <code>foo.ps1</code> will be
stored as UTF-8 internally. A client without <code>working-tree-encoding</code>
support will checkout <code>foo.ps1</code> as UTF-8 encoded file. This will
typically cause trouble for the users of this file.</p>
</div>
<div class="paragraph">
<p>If a Git client that does not support the <code>working-tree-encoding</code>
attribute adds a new file <code>bar.ps1</code>, then <code>bar.ps1</code> will be
stored "as-is" internally (in this example probably as UTF-16).
A client with <code>working-tree-encoding</code> support will interpret the
internal contents as UTF-8 and try to convert it to UTF-16 on checkout.
That operation will fail and cause an error.</p>
</div>
</li>
<li>
<p>Reencoding content to non-UTF encodings can cause errors as the
conversion might not be UTF-8 round trip safe. If you suspect your
encoding to not be round trip safe, then add it to
<code>core.checkRoundtripEncoding</code> to make Git check the round trip
encoding (see <a href="git-config.html">git-config(1)</a>). SHIFT-JIS (Japanese character
set) is known to have round trip issues with UTF-8 and is checked by
default.</p>
</li>
<li>
<p>Reencoding content requires resources that might slow down certain
Git operations (e.g <em>git checkout</em> or <em>git add</em>).</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Use the <code>working-tree-encoding</code> attribute only if you cannot store a file
in UTF-8 encoding and if you want Git to be able to process the content
as text.</p>
</div>
<div class="paragraph">
<p>As an example, use the following attributes if your <em>*.ps1</em> files are
UTF-16 encoded with byte order mark (BOM) and you want Git to perform
automatic line ending conversion based on your platform.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.ps1 text working-tree-encoding=UTF-16</pre>
</div>
</div>
<div class="paragraph">
<p>Use the following attributes if your <em>*.ps1</em> files are UTF-16 little
endian encoded without BOM and you want Git to use Windows line endings
in the working directory (use <code>UTF-16LE-BOM</code> instead of <code>UTF-16LE</code> if
you want UTF-16 little endian with BOM).
Please note, it is highly recommended to
explicitly define the line endings with <code>eol</code> if the <code>working-tree-encoding</code>
attribute is used to avoid ambiguity.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.ps1 text working-tree-encoding=UTF-16LE eol=CRLF</pre>
</div>
</div>
<div class="paragraph">
<p>You can get a list of all available encodings on your platform with the
following command:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>iconv --list</pre>
</div>
</div>
<div class="paragraph">
<p>If you do not know the encoding of a file, then you can use the <code>file</code>
command to guess the encoding:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>file foo.ps1</pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_ident"><code>ident</code></h4>
<div class="paragraph">
<p>When the attribute <code>ident</code> is set for a path, Git replaces
<code>$Id$</code> in the blob object with <code>$Id:</code>, followed by the
40-character hexadecimal blob object name, followed by a dollar
sign <code>$</code> upon checkout. Any byte sequence that begins with
<code>$Id:</code> and ends with <code>$</code> in the worktree file is replaced
with <code>$Id$</code> upon check-in.</p>
</div>
</div>
<div class="sect3">
<h4 id="_filter"><code>filter</code></h4>
<div class="paragraph">
<p>A <code>filter</code> attribute can be set to a string value that names a
filter driver specified in the configuration.</p>
</div>
<div class="paragraph">
<p>A filter driver consists of a <code>clean</code> command and a <code>smudge</code>
command, either of which can be left unspecified. Upon
checkout, when the <code>smudge</code> command is specified, the command is
fed the blob object from its standard input, and its standard
output is used to update the worktree file. Similarly, the
<code>clean</code> command is used to convert the contents of worktree file
upon checkin. By default these commands process only a single
blob and terminate. If a long running <code>process</code> filter is used
in place of <code>clean</code> and/or <code>smudge</code> filters, then Git can process
all blobs with a single filter command invocation for the entire
life of a single Git command, for example <code>git add --all</code>. If a
long running <code>process</code> filter is configured then it always takes
precedence over a configured single blob filter. See section
below for the description of the protocol used to communicate with
a <code>process</code> filter.</p>
</div>
<div class="paragraph">
<p>One use of the content filtering is to massage the content into a shape
that is more convenient for the platform, filesystem, and the user to use.
For this mode of operation, the key phrase here is "more convenient" and
not "turning something unusable into usable". In other words, the intent
is that if someone unsets the filter driver definition, or does not have
the appropriate filter program, the project should still be usable.</p>
</div>
<div class="paragraph">
<p>Another use of the content filtering is to store the content that cannot
be directly used in the repository (e.g. a UUID that refers to the true
content stored outside Git, or an encrypted content) and turn it into a
usable form upon checkout (e.g. download the external content, or decrypt
the encrypted content).</p>
</div>
<div class="paragraph">
<p>These two filters behave differently, and by default, a filter is taken as
the former, massaging the contents into more convenient shape. A missing
filter driver definition in the config, or a filter driver that exits with
a non-zero status, is not an error but makes the filter a no-op passthru.</p>
</div>
<div class="paragraph">
<p>You can declare that a filter turns a content that by itself is unusable
into a usable content by setting the filter.<driver>.required configuration
variable to <code>true</code>.</p>
</div>
<div class="paragraph">
<p>Note: Whenever the clean filter is changed, the repo should be renormalized:
$ git add --renormalize .</p>
</div>
<div class="paragraph">
<p>For example, in .gitattributes, you would assign the <code>filter</code>
attribute for paths.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.c filter=indent</pre>
</div>
</div>
<div class="paragraph">
<p>Then you would define a "filter.indent.clean" and "filter.indent.smudge"
configuration in your .git/config to specify a pair of commands to
modify the contents of C programs when the source files are checked
in ("clean" is run) and checked out (no change is made because the
command is "cat").</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[filter "indent"]
clean = indent
smudge = cat</pre>
</div>
</div>
<div class="paragraph">
<p>For best results, <code>clean</code> should not alter its output further if it is
run twice ("clean→clean" should be equivalent to "clean"), and
multiple <code>smudge</code> commands should not alter <code>clean</code>'s output
("smudge→smudge→clean" should be equivalent to "clean"). See the
section on merging below.</p>
</div>
<div class="paragraph">
<p>The "indent" filter is well-behaved in this regard: it will not modify
input that is already correctly indented. In this case, the lack of a
smudge filter means that the clean filter <em>must</em> accept its own output
without modifying it.</p>
</div>
<div class="paragraph">
<p>If a filter <em>must</em> succeed in order to make the stored contents usable,
you can declare that the filter is <code>required</code>, in the configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[filter "crypt"]
clean = openssl enc ...
smudge = openssl enc -d ...
required</pre>
</div>
</div>
<div class="paragraph">
<p>Sequence "%f" on the filter command line is replaced with the name of
the file the filter is working on. A filter might use this in keyword
substitution. For example:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[filter "p4"]
clean = git-p4-filter --clean %f
smudge = git-p4-filter --smudge %f</pre>
</div>
</div>
<div class="paragraph">
<p>Note that "%f" is the name of the path that is being worked on. Depending
on the version that is being filtered, the corresponding file on disk may
not exist, or may have different contents. So, smudge and clean commands
should not try to access the file on disk, but only act as filters on the
content provided to them on standard input.</p>
</div>
</div>
<div class="sect3">
<h4 id="_long_running_filter_process">Long Running Filter Process</h4>
<div class="paragraph">
<p>If the filter command (a string value) is defined via
<code>filter.<driver>.process</code> then Git can process all blobs with a
single filter invocation for the entire life of a single Git
command. This is achieved by using the long-running process protocol
(described in technical/long-running-process-protocol.txt).</p>
</div>
<div class="paragraph">
<p>When Git encounters the first file that needs to be cleaned or smudged,
it starts the filter and performs the handshake. In the handshake, the
welcome message sent by Git is "git-filter-client", only version 2 is
supported, and the supported capabilities are "clean", "smudge", and
"delay".</p>
</div>
<div class="paragraph">
<p>Afterwards Git sends a list of "key=value" pairs terminated with
a flush packet. The list will contain at least the filter command
(based on the supported capabilities) and the pathname of the file
to filter relative to the repository root. Right after the flush packet
Git sends the content split in zero or more pkt-line packets and a
flush packet to terminate content. Please note, that the filter
must not send any response before it received the content and the
final flush packet. Also note that the "value" of a "key=value" pair
can contain the "=" character whereas the key would never contain
that character.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git> command=smudge
packet: git> pathname=path/testfile.dat
packet: git> 0000
packet: git> CONTENT
packet: git> 0000</pre>
</div>
</div>
<div class="paragraph">
<p>The filter is expected to respond with a list of "key=value" pairs
terminated with a flush packet. If the filter does not experience
problems then the list must contain a "success" status. Right after
these packets the filter is expected to send the content in zero
or more pkt-line packets and a flush packet at the end. Finally, a
second list of "key=value" pairs terminated with a flush packet
is expected. The filter can change the status in the second list
or keep the status as is with an empty list. Please note that the
empty list must be terminated with a flush packet regardless.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git< status=success
packet: git< 0000
packet: git< SMUDGED_CONTENT
packet: git< 0000
packet: git< 0000 # empty list, keep "status=success" unchanged!</pre>
</div>
</div>
<div class="paragraph">
<p>If the result content is empty then the filter is expected to respond
with a "success" status and a flush packet to signal the empty content.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git< status=success
packet: git< 0000
packet: git< 0000 # empty content!
packet: git< 0000 # empty list, keep "status=success" unchanged!</pre>
</div>
</div>
<div class="paragraph">
<p>In case the filter cannot or does not want to process the content,
it is expected to respond with an "error" status.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git< status=error
packet: git< 0000</pre>
</div>
</div>
<div class="paragraph">
<p>If the filter experiences an error during processing, then it can
send the status "error" after the content was (partially or
completely) sent.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git< status=success
packet: git< 0000
packet: git< HALF_WRITTEN_ERRONEOUS_CONTENT
packet: git< 0000
packet: git< status=error
packet: git< 0000</pre>
</div>
</div>
<div class="paragraph">
<p>In case the filter cannot or does not want to process the content
as well as any future content for the lifetime of the Git process,
then it is expected to respond with an "abort" status at any point
in the protocol.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git< status=abort
packet: git< 0000</pre>
</div>
</div>
<div class="paragraph">
<p>Git neither stops nor restarts the filter process in case the
"error"/"abort" status is set. However, Git sets its exit code
according to the <code>filter.<driver>.required</code> flag, mimicking the
behavior of the <code>filter.<driver>.clean</code> / <code>filter.<driver>.smudge</code>
mechanism.</p>
</div>
<div class="paragraph">
<p>If the filter dies during the communication or does not adhere to
the protocol then Git will stop the filter process and restart it
with the next file that needs to be processed. Depending on the
<code>filter.<driver>.required</code> flag Git will interpret that as error.</p>
</div>
</div>
<div class="sect3">
<h4 id="_delay">Delay</h4>
<div class="paragraph">
<p>If the filter supports the "delay" capability, then Git can send the
flag "can-delay" after the filter command and pathname. This flag
denotes that the filter can delay filtering the current blob (e.g. to
compensate network latencies) by responding with no content but with
the status "delayed" and a flush packet.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git> command=smudge
packet: git> pathname=path/testfile.dat
packet: git> can-delay=1
packet: git> 0000
packet: git> CONTENT
packet: git> 0000
packet: git< status=delayed
packet: git< 0000</pre>
</div>
</div>
<div class="paragraph">
<p>If the filter supports the "delay" capability then it must support the
"list_available_blobs" command. If Git sends this command, then the
filter is expected to return a list of pathnames representing blobs
that have been delayed earlier and are now available.
The list must be terminated with a flush packet followed
by a "success" status that is also terminated with a flush packet. If
no blobs for the delayed paths are available, yet, then the filter is
expected to block the response until at least one blob becomes
available. The filter can tell Git that it has no more delayed blobs
by sending an empty list. As soon as the filter responds with an empty
list, Git stops asking. All blobs that Git has not received at this
point are considered missing and will result in an error.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git> command=list_available_blobs
packet: git> 0000
packet: git< pathname=path/testfile.dat
packet: git< pathname=path/otherfile.dat
packet: git< 0000
packet: git< status=success
packet: git< 0000</pre>
</div>
</div>
<div class="paragraph">
<p>After Git received the pathnames, it will request the corresponding
blobs again. These requests contain a pathname and an empty content
section. The filter is expected to respond with the smudged content
in the usual way as explained above.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>packet: git> command=smudge
packet: git> pathname=path/testfile.dat
packet: git> 0000
packet: git> 0000 # empty content!
packet: git< status=success
packet: git< 0000
packet: git< SMUDGED_CONTENT
packet: git< 0000
packet: git< 0000 # empty list, keep "status=success" unchanged!</pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_example">Example</h4>
<div class="paragraph">
<p>A long running filter demo implementation can be found in
<code>contrib/long-running-filter/example.pl</code> located in the Git
core repository. If you develop your own long running filter
process then the <code>GIT_TRACE_PACKET</code> environment variables can be
very helpful for debugging (see <a href="git.html">git(1)</a>).</p>
</div>
<div class="paragraph">
<p>Please note that you cannot use an existing <code>filter.<driver>.clean</code>
or <code>filter.<driver>.smudge</code> command with <code>filter.<driver>.process</code>
because the former two use a different inter process communication
protocol than the latter one.</p>
</div>
</div>
<div class="sect3">
<h4 id="_interaction_between_checkincheckout_attributes">Interaction between checkin/checkout attributes</h4>
<div class="paragraph">
<p>In the check-in codepath, the worktree file is first converted
with <code>filter</code> driver (if specified and corresponding driver
defined), then the result is processed with <code>ident</code> (if
specified), and then finally with <code>text</code> (again, if specified
and applicable).</p>
</div>
<div class="paragraph">
<p>In the check-out codepath, the blob content is first converted
with <code>text</code>, and then <code>ident</code> and fed to <code>filter</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_merging_branches_with_differing_checkincheckout_attributes">Merging branches with differing checkin/checkout attributes</h4>
<div class="paragraph">
<p>If you have added attributes to a file that cause the canonical
repository format for that file to change, such as adding a
clean/smudge filter or text/eol/ident attributes, merging anything
where the attribute is not in place would normally cause merge
conflicts.</p>
</div>
<div class="paragraph">
<p>To prevent these unnecessary merge conflicts, Git can be told to run a
virtual check-out and check-in of all three stages of a file when
resolving a three-way merge by setting the <code>merge.renormalize</code>
configuration variable. This prevents changes caused by check-in
conversion from causing spurious merge conflicts when a converted file
is merged with an unconverted file.</p>
</div>
<div class="paragraph">
<p>As long as a "smudge→clean" results in the same output as a "clean"
even on files that are already smudged, this strategy will
automatically resolve all filter-related conflicts. Filters that do
not act in this way may cause additional merge conflicts that must be
resolved manually.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_generating_diff_text">Generating diff text</h3>
<div class="sect3">
<h4 id="_diff"><code>diff</code></h4>
<div class="paragraph">
<p>The attribute <code>diff</code> affects how Git generates diffs for particular
files. It can tell Git whether to generate a textual patch for the path
or to treat the path as a binary file. It can also affect what line is
shown on the hunk header <code>@@ -k,l +n,m @@</code> line, tell Git to use an
external command to generate the diff, or ask Git to convert binary
files to a text format before generating the diff.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set</dt>
<dd>
<p>A path to which the <code>diff</code> attribute is set is treated
as text, even when they contain byte values that
normally never appear in text files, such as NUL.</p>
</dd>
<dt class="hdlist1">Unset</dt>
<dd>
<p>A path to which the <code>diff</code> attribute is unset will
generate <code>Binary files differ</code> (or a binary patch, if
binary patches are enabled).</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>A path to which the <code>diff</code> attribute is unspecified
first gets its contents inspected, and if it looks like
text and is smaller than core.bigFileThreshold, it is treated
as text. Otherwise it would generate <code>Binary files differ</code>.</p>
</dd>
<dt class="hdlist1">String</dt>
<dd>
<p>Diff is shown using the specified diff driver. Each driver may
specify one or more options, as described in the following
section. The options for the diff driver "foo" are defined
by the configuration variables in the "diff.foo" section of the
Git config file.</p>
</dd>
</dl>
</div>
</div>
<div class="sect3">
<h4 id="_defining_an_external_diff_driver">Defining an external diff driver</h4>
<div class="paragraph">
<p>The definition of a diff driver is done in <code>gitconfig</code>, not
<code>gitattributes</code> file, so strictly speaking this manual page is a
wrong place to talk about it. However…​</p>
</div>
<div class="paragraph">
<p>To define an external diff driver <code>jcdiff</code>, add a section to your
<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "jcdiff"]
command = j-c-diff</pre>
</div>
</div>
<div class="paragraph">
<p>When Git needs to show you a diff for the path with <code>diff</code>
attribute set to <code>jcdiff</code>, it calls the command you specified
with the above configuration, i.e. <code>j-c-diff</code>, with 7
parameters, just like <code>GIT_EXTERNAL_DIFF</code> program is called.
See <a href="git.html">git(1)</a> for details.</p>
</div>
</div>
<div class="sect3">
<h4 id="_setting_the_internal_diff_algorithm">Setting the internal diff algorithm</h4>
<div class="paragraph">
<p>The diff algorithm can be set through the <code>diff.algorithm</code> config key, but
sometimes it may be helpful to set the diff algorithm per path. For example,
one may want to use the <code>minimal</code> diff algorithm for .json files, and the
<code>histogram</code> for .c files, and so on without having to pass in the algorithm
through the command line each time.</p>
</div>
<div class="paragraph">
<p>First, in <code>.gitattributes</code>, assign the <code>diff</code> attribute for paths.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.json diff=<name></pre>
</div>
</div>
<div class="paragraph">
<p>Then, define a "diff.<name>.algorithm" configuration to specify the diff
algorithm, choosing from <code>myers</code>, <code>patience</code>, <code>minimal</code>, or <code>histogram</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "<name>"]
algorithm = histogram</pre>
</div>
</div>
<div class="paragraph">
<p>This diff algorithm applies to user facing diff output like git-diff(1),
git-show(1) and is used for the <code>--stat</code> output as well. The merge machinery
will not use the diff algorithm set through this method.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
If <code>diff.<name>.command</code> is defined for path with the
<code>diff=<name></code> attribute, it is executed as an external diff driver
(see above), and adding <code>diff.<name>.algorithm</code> has no effect, as the
algorithm is not passed to the external diff driver.
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_defining_a_custom_hunk_header">Defining a custom hunk-header</h4>
<div class="paragraph">
<p>Each group of changes (called a "hunk") in the textual diff output
is prefixed with a line of the form:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>@@ -k,l +n,m @@ TEXT</pre>
</div>
</div>
<div class="paragraph">
<p>This is called a <em>hunk header</em>. The "TEXT" portion is by default a line
that begins with an alphabet, an underscore or a dollar sign; this
matches what GNU <em>diff -p</em> output uses. This default selection however
is not suited for some contents, and you can use a customized pattern
to make a selection.</p>
</div>
<div class="paragraph">
<p>First, in .gitattributes, you would assign the <code>diff</code> attribute
for paths.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.tex diff=tex</pre>
</div>
</div>
<div class="paragraph">
<p>Then, you would define a "diff.tex.xfuncname" configuration to
specify a regular expression that matches a line that you would
want to appear as the hunk header "TEXT". Add a section to your
<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "tex"]
xfuncname = "^(\\\\(sub)*section\\{.*)$"</pre>
</div>
</div>
<div class="paragraph">
<p>Note. A single level of backslashes are eaten by the
configuration file parser, so you would need to double the
backslashes; the pattern above picks a line that begins with a
backslash, and zero or more occurrences of <code>sub</code> followed by
<code>section</code> followed by open brace, to the end of line.</p>
</div>
<div class="paragraph">
<p>There are a few built-in patterns to make this easier, and <code>tex</code>
is one of them, so you do not have to write the above in your
configuration file (you still need to enable this with the
attribute mechanism, via <code>.gitattributes</code>). The following built in
patterns are available:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>ada</code> suitable for source code in the Ada language.</p>
</li>
<li>
<p><code>bash</code> suitable for source code in the Bourne-Again SHell language.
Covers a superset of POSIX shell function definitions.</p>
</li>
<li>
<p><code>bibtex</code> suitable for files with BibTeX coded references.</p>
</li>
<li>
<p><code>cpp</code> suitable for source code in the C and C++ languages.</p>
</li>
<li>
<p><code>csharp</code> suitable for source code in the C# language.</p>
</li>
<li>
<p><code>css</code> suitable for cascading style sheets.</p>
</li>
<li>
<p><code>dts</code> suitable for devicetree (DTS) files.</p>
</li>
<li>
<p><code>elixir</code> suitable for source code in the Elixir language.</p>
</li>
<li>
<p><code>fortran</code> suitable for source code in the Fortran language.</p>
</li>
<li>
<p><code>fountain</code> suitable for Fountain documents.</p>
</li>
<li>
<p><code>golang</code> suitable for source code in the Go language.</p>
</li>
<li>
<p><code>html</code> suitable for HTML/XHTML documents.</p>
</li>
<li>
<p><code>java</code> suitable for source code in the Java language.</p>
</li>
<li>
<p><code>kotlin</code> suitable for source code in the Kotlin language.</p>
</li>
<li>
<p><code>markdown</code> suitable for Markdown documents.</p>
</li>
<li>
<p><code>matlab</code> suitable for source code in the MATLAB and Octave languages.</p>
</li>
<li>
<p><code>objc</code> suitable for source code in the Objective-C language.</p>
</li>
<li>
<p><code>pascal</code> suitable for source code in the Pascal/Delphi language.</p>
</li>
<li>
<p><code>perl</code> suitable for source code in the Perl language.</p>
</li>
<li>
<p><code>php</code> suitable for source code in the PHP language.</p>
</li>
<li>
<p><code>python</code> suitable for source code in the Python language.</p>
</li>
<li>
<p><code>ruby</code> suitable for source code in the Ruby language.</p>
</li>
<li>
<p><code>rust</code> suitable for source code in the Rust language.</p>
</li>
<li>
<p><code>scheme</code> suitable for source code in the Scheme language.</p>
</li>
<li>
<p><code>tex</code> suitable for source code for LaTeX documents.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="_customizing_word_diff">Customizing word diff</h4>
<div class="paragraph">
<p>You can customize the rules that <code>git diff --word-diff</code> uses to
split words in a line, by specifying an appropriate regular expression
in the "diff.*.wordRegex" configuration variable. For example, in TeX
a backslash followed by a sequence of letters forms a command, but
several such commands can be run together without intervening
whitespace. To separate them, use a regular expression in your
<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "tex"]
wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"</pre>
</div>
</div>
<div class="paragraph">
<p>A built-in pattern is provided for all languages listed in the
previous section.</p>
</div>
</div>
<div class="sect3">
<h4 id="_performing_text_diffs_of_binary_files">Performing text diffs of binary files</h4>
<div class="paragraph">
<p>Sometimes it is desirable to see the diff of a text-converted
version of some binary files. For example, a word processor
document can be converted to an ASCII text representation, and
the diff of the text shown. Even though this conversion loses
some information, the resulting diff is useful for human
viewing (but cannot be applied directly).</p>
</div>
<div class="paragraph">
<p>The <code>textconv</code> config option is used to define a program for
performing such a conversion. The program should take a single
argument, the name of a file to convert, and produce the
resulting text on stdout.</p>
</div>
<div class="paragraph">
<p>For example, to show the diff of the exif information of a
file instead of the binary information (assuming you have the
exif tool installed), add the following section to your
<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file):</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "jpg"]
textconv = exif</pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
The text conversion is generally a one-way conversion;
in this example, we lose the actual image contents and focus
just on the text data. This means that diffs generated by
textconv are <em>not</em> suitable for applying. For this reason,
only <code>git diff</code> and the <code>git log</code> family of commands (i.e.,
log, whatchanged, show) will perform text conversion. <code>git
format-patch</code> will never generate this output. If you want to
send somebody a text-converted diff of a binary file (e.g.,
because it quickly conveys the changes you have made), you
should generate it separately and send it as a comment <em>in
addition to</em> the usual binary diff that you might send.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Because text conversion can be slow, especially when doing a
large number of them with <code>git log -p</code>, Git provides a mechanism
to cache the output and use it in future diffs. To enable
caching, set the "cachetextconv" variable in your diff driver’s
config. For example:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "jpg"]
textconv = exif
cachetextconv = true</pre>
</div>
</div>
<div class="paragraph">
<p>This will cache the result of running "exif" on each blob
indefinitely. If you change the textconv config variable for a
diff driver, Git will automatically invalidate the cache entries
and re-run the textconv filter. If you want to invalidate the
cache manually (e.g., because your version of "exif" was updated
and now produces better output), you can remove the cache
manually with <code>git update-ref -d refs/notes/textconv/jpg</code> (where
"jpg" is the name of the diff driver, as in the example above).</p>
</div>
</div>
<div class="sect3">
<h4 id="_choosing_textconv_versus_external_diff">Choosing textconv versus external diff</h4>
<div class="paragraph">
<p>If you want to show differences between binary or specially-formatted
blobs in your repository, you can choose to use either an external diff
command, or to use textconv to convert them to a diff-able text format.
Which method you choose depends on your exact situation.</p>
</div>
<div class="paragraph">
<p>The advantage of using an external diff command is flexibility. You are
not bound to find line-oriented changes, nor is it necessary for the
output to resemble unified diff. You are free to locate and report
changes in the most appropriate way for your data format.</p>
</div>
<div class="paragraph">
<p>A textconv, by comparison, is much more limiting. You provide a
transformation of the data into a line-oriented text format, and Git
uses its regular diff tools to generate the output. There are several
advantages to choosing this method:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Ease of use. It is often much simpler to write a binary to text
transformation than it is to perform your own diff. In many cases,
existing programs can be used as textconv filters (e.g., exif,
odt2txt).</p>
</li>
<li>
<p>Git diff features. By performing only the transformation step
yourself, you can still utilize many of Git’s diff features,
including colorization, word-diff, and combined diffs for merges.</p>
</li>
<li>
<p>Caching. Textconv caching can speed up repeated diffs, such as those
you might trigger by running <code>git log -p</code>.</p>
</li>
</ol>
</div>
</div>
<div class="sect3">
<h4 id="_marking_files_as_binary">Marking files as binary</h4>
<div class="paragraph">
<p>Git usually guesses correctly whether a blob contains text or binary
data by examining the beginning of the contents. However, sometimes you
may want to override its decision, either because a blob contains binary
data later in the file, or because the content, while technically
composed of text characters, is opaque to a human reader. For example,
many postscript files contain only ASCII characters, but produce noisy
and meaningless diffs.</p>
</div>
<div class="paragraph">
<p>The simplest way to mark a file as binary is to unset the diff
attribute in the <code>.gitattributes</code> file:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.ps -diff</pre>
</div>
</div>
<div class="paragraph">
<p>This will cause Git to generate <code>Binary files differ</code> (or a binary
patch, if binary patches are enabled) instead of a regular diff.</p>
</div>
<div class="paragraph">
<p>However, one may also want to specify other diff driver attributes. For
example, you might want to use <code>textconv</code> to convert postscript files to
an ASCII representation for human viewing, but otherwise treat them as
binary files. You cannot specify both <code>-diff</code> and <code>diff=ps</code> attributes.
The solution is to use the <code>diff.*.binary</code> config option:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[diff "ps"]
textconv = ps2ascii
binary = true</pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_performing_a_three_way_merge">Performing a three-way merge</h3>
<div class="sect3">
<h4 id="_merge"><code>merge</code></h4>
<div class="paragraph">
<p>The attribute <code>merge</code> affects how three versions of a file are
merged when a file-level merge is necessary during <code>git merge</code>,
and other commands such as <code>git revert</code> and <code>git cherry-pick</code>.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set</dt>
<dd>
<p>Built-in 3-way merge driver is used to merge the
contents in a way similar to <em>merge</em> command of <code>RCS</code>
suite. This is suitable for ordinary text files.</p>
</dd>
<dt class="hdlist1">Unset</dt>
<dd>
<p>Take the version from the current branch as the
tentative merge result, and declare that the merge has
conflicts. This is suitable for binary files that do
not have a well-defined merge semantics.</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>By default, this uses the same built-in 3-way merge
driver as is the case when the <code>merge</code> attribute is set.
However, the <code>merge.default</code> configuration variable can name
different merge driver to be used with paths for which the
<code>merge</code> attribute is unspecified.</p>
</dd>
<dt class="hdlist1">String</dt>
<dd>
<p>3-way merge is performed using the specified custom
merge driver. The built-in 3-way merge driver can be
explicitly specified by asking for "text" driver; the
built-in "take the current branch" driver can be
requested with "binary".</p>
</dd>
</dl>
</div>
</div>
<div class="sect3">
<h4 id="_built_in_merge_drivers">Built-in merge drivers</h4>
<div class="paragraph">
<p>There are a few built-in low-level merge drivers defined that
can be asked for via the <code>merge</code> attribute.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">text</dt>
<dd>
<p>Usual 3-way file level merge for text files. Conflicted
regions are marked with conflict markers <code><<<<<<<</code>,
<code>=======</code> and <code>>>>>>>></code>. The version from your branch
appears before the <code>=======</code> marker, and the version
from the merged branch appears after the <code>=======</code>
marker.</p>
</dd>
<dt class="hdlist1">binary</dt>
<dd>
<p>Keep the version from your branch in the work tree, but
leave the path in the conflicted state for the user to
sort out.</p>
</dd>
<dt class="hdlist1">union</dt>
<dd>
<p>Run 3-way file level merge for text files, but take
lines from both versions, instead of leaving conflict
markers. This tends to leave the added lines in the
resulting file in random order and the user should
verify the result. Do not use this if you do not
understand the implications.</p>
</dd>
</dl>
</div>
</div>
<div class="sect3">
<h4 id="_defining_a_custom_merge_driver">Defining a custom merge driver</h4>
<div class="paragraph">
<p>The definition of a merge driver is done in the <code>.git/config</code>
file, not in the <code>gitattributes</code> file, so strictly speaking this
manual page is a wrong place to talk about it. However…​</p>
</div>
<div class="paragraph">
<p>To define a custom merge driver <code>filfre</code>, add a section to your
<code>$GIT_DIR/config</code> file (or <code>$HOME/.gitconfig</code> file) like this:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[merge "filfre"]
name = feel-free merge driver
driver = filfre %O %A %B %L %P
recursive = binary</pre>
</div>
</div>
<div class="paragraph">
<p>The <code>merge.*.name</code> variable gives the driver a human-readable
name.</p>
</div>
<div class="paragraph">
<p>The <code>merge.*.driver</code> variable’s value is used to construct a
command to run to merge ancestor’s version (<code>%O</code>), current
version (<code>%A</code>) and the other branches' version (<code>%B</code>). These
three tokens are replaced with the names of temporary files that
hold the contents of these versions when the command line is
built. Additionally, %L will be replaced with the conflict marker
size (see below).</p>
</div>
<div class="paragraph">
<p>The merge driver is expected to leave the result of the merge in
the file named with <code>%A</code> by overwriting it, and exit with zero
status if it managed to merge them cleanly, or non-zero if there
were conflicts. When the driver crashes (e.g. killed by SEGV),
it is expected to exit with non-zero status that are higher than
128, and in such a case, the merge results in a failure (which is
different from producing a conflict).</p>
</div>
<div class="paragraph">
<p>The <code>merge.*.recursive</code> variable specifies what other merge
driver to use when the merge driver is called for an internal
merge between common ancestors, when there are more than one.
When left unspecified, the driver itself is used for both
internal merge and the final merge.</p>
</div>
<div class="paragraph">
<p>The merge driver can learn the pathname in which the merged result
will be stored via placeholder <code>%P</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_conflict_marker_size"><code>conflict-marker-size</code></h4>
<div class="paragraph">
<p>This attribute controls the length of conflict markers left in
the work tree file during a conflicted merge. Only a positive
integer has a meaningful effect.</p>
</div>
<div class="paragraph">
<p>For example, this line in <code>.gitattributes</code> can be used to tell the merge
machinery to leave much longer (instead of the usual 7-character-long)
conflict markers when merging the file <code>Documentation/git-merge.txt</code>
results in a conflict.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>Documentation/git-merge.txt conflict-marker-size=32</pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_checking_whitespace_errors">Checking whitespace errors</h3>
<div class="sect3">
<h4 id="_whitespace"><code>whitespace</code></h4>
<div class="paragraph">
<p>The <code>core.whitespace</code> configuration variable allows you to define what
<em>diff</em> and <em>apply</em> should consider whitespace errors for all paths in
the project (See <a href="git-config.html">git-config(1)</a>). This attribute gives you finer
control per path.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Set</dt>
<dd>
<p>Notice all types of potential whitespace errors known to Git.
The tab width is taken from the value of the <code>core.whitespace</code>
configuration variable.</p>
</dd>
<dt class="hdlist1">Unset</dt>
<dd>
<p>Do not notice anything as error.</p>
</dd>
<dt class="hdlist1">Unspecified</dt>
<dd>
<p>Use the value of the <code>core.whitespace</code> configuration variable to
decide what to notice as error.</p>
</dd>
<dt class="hdlist1">String</dt>
<dd>
<p>Specify a comma separated list of common whitespace problems to
notice in the same format as the <code>core.whitespace</code> configuration
variable.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_creating_an_archive">Creating an archive</h3>
<div class="sect3">
<h4 id="_export_ignore"><code>export-ignore</code></h4>
<div class="paragraph">
<p>Files and directories with the attribute <code>export-ignore</code> won’t be added to
archive files.</p>
</div>
</div>
<div class="sect3">
<h4 id="_export_subst"><code>export-subst</code></h4>
<div class="paragraph">
<p>If the attribute <code>export-subst</code> is set for a file then Git will expand
several placeholders when adding this file to an archive. The
expansion depends on the availability of a commit ID, i.e., if
<a href="git-archive.html">git-archive(1)</a> has been given a tree instead of a commit or a
tag then no replacement will be done. The placeholders are the same
as those for the option <code>--pretty=format:</code> of <a href="git-log.html">git-log(1)</a>,
except that they need to be wrapped like this: <code>$Format:PLACEHOLDERS$</code>
in the file. E.g. the string <code>$Format:%H$</code> will be replaced by the
commit hash. However, only one <code>%(describe)</code> placeholder is expanded
per archive to avoid denial-of-service attacks.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_packing_objects">Packing objects</h3>
<div class="sect3">
<h4 id="_delta"><code>delta</code></h4>
<div class="paragraph">
<p>Delta compression will not be attempted for blobs for paths with the
attribute <code>delta</code> set to false.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_viewing_files_in_gui_tools">Viewing files in GUI tools</h3>
<div class="sect3">
<h4 id="_encoding"><code>encoding</code></h4>
<div class="paragraph">
<p>The value of this attribute specifies the character encoding that should
be used by GUI tools (e.g. <a href="gitk.html">gitk(1)</a> and <a href="git-gui.html">git-gui(1)</a>) to
display the contents of the relevant file. Note that due to performance
considerations <a href="gitk.html">gitk(1)</a> does not use this attribute unless you
manually enable per-file encodings in its options.</p>
</div>
<div class="paragraph">
<p>If this attribute is not set or has an invalid value, the value of the
<code>gui.encoding</code> configuration variable is used instead
(See <a href="git-config.html">git-config(1)</a>).</p>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_using_macro_attributes">USING MACRO ATTRIBUTES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You do not want any end-of-line conversions applied to, nor textual diffs
produced for, any binary file you track. You would need to specify e.g.</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.jpg -text -diff</pre>
</div>
</div>
<div class="paragraph">
<p>but that may become cumbersome, when you have many attributes. Using
macro attributes, you can define an attribute that, when set, also
sets or unsets a number of other attributes at the same time. The
system knows a built-in macro attribute, <code>binary</code>:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>*.jpg binary</pre>
</div>
</div>
<div class="paragraph">
<p>Setting the "binary" attribute also unsets the "text" and "diff"
attributes as above. Note that macro attributes can only be "Set",
though setting one might have the effect of setting or unsetting other
attributes or even returning other attributes to the "Unspecified"
state.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_defining_macro_attributes">DEFINING MACRO ATTRIBUTES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Custom macro attributes can be defined only in top-level gitattributes
files (<code>$GIT_DIR/info/attributes</code>, the <code>.gitattributes</code> file at the
top level of the working tree, or the global or system-wide
gitattributes files), not in <code>.gitattributes</code> files in working tree
subdirectories. The built-in macro attribute "binary" is equivalent
to:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>[attr]binary -diff -merge -text</pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_notes">NOTES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Git does not follow symbolic links when accessing a <code>.gitattributes</code>
file in the working tree. This keeps behavior consistent when the file
is accessed from the index or a tree versus from the filesystem.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>If you have these three <code>gitattributes</code> file:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>(in $GIT_DIR/info/attributes)
a* foo !bar -baz
(in .gitattributes)
abc foo bar baz
(in t/.gitattributes)
ab* merge=filfre
abc -foo -bar
*.c frotz</pre>
</div>
</div>
<div class="paragraph">
<p>the attributes given to path <code>t/abc</code> are computed as follows:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>By examining <code>t/.gitattributes</code> (which is in the same
directory as the path in question), Git finds that the first
line matches. <code>merge</code> attribute is set. It also finds that
the second line matches, and attributes <code>foo</code> and <code>bar</code>
are unset.</p>
</li>
<li>
<p>Then it examines <code>.gitattributes</code> (which is in the parent
directory), and finds that the first line matches, but
<code>t/.gitattributes</code> file already decided how <code>merge</code>, <code>foo</code>
and <code>bar</code> attributes should be given to this path, so it
leaves <code>foo</code> and <code>bar</code> unset. Attribute <code>baz</code> is set.</p>
</li>
<li>
<p>Finally it examines <code>$GIT_DIR/info/attributes</code>. This file
is used to override the in-tree settings. The first line is
a match, and <code>foo</code> is set, <code>bar</code> is reverted to unspecified
state, and <code>baz</code> is unset.</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>As the result, the attributes assignment to <code>t/abc</code> becomes:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>foo set to true
bar unspecified
baz set to false
merge set to string value "filfre"
frotz unspecified</pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="git-check-attr.html">git-check-attr(1)</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_git">GIT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Part of the <a href="git.html">git(1)</a> suite</p>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-05-31 00:41:06 UTC
</div>
</div>
</body>
</html>
Zerion Mini Shell 1.0