summaryrefslogtreecommitdiffstats
path: root/gitattributes.html
diff options
context:
space:
mode:
authorJunio C Hamano <junio@hera.kernel.org>2007-04-22 07:22:13 +0000
committerJunio C Hamano <junio@hera.kernel.org>2007-04-22 07:22:13 +0000
commite90436a8b30ea0a8fa8b6aecfd66f48f650a58e2 (patch)
tree1e097771207a7728da25867ca2cb97a0a107934e /gitattributes.html
parent81c711d2a9a496ba11cf26049580b3d02c21783f (diff)
downloadgit-htmldocs-e90436a8b30ea0a8fa8b6aecfd66f48f650a58e2.tar.gz
Autogenerated HTML docs for v1.5.1.2-242-g2d765
Diffstat (limited to 'gitattributes.html')
-rw-r--r--gitattributes.html596
1 files changed, 596 insertions, 0 deletions
diff --git a/gitattributes.html b/gitattributes.html
new file mode 100644
index 000000000..071fab7fd
--- /dev/null
+++ b/gitattributes.html
@@ -0,0 +1,596 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 7.0.2" />
+<style type="text/css">
+/* Debug borders */
+p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
+/*
+ border: 1px solid red;
+*/
+}
+
+body {
+ margin: 1em 5% 1em 5%;
+}
+
+a { color: blue; }
+a:visited { color: fuchsia; }
+
+em {
+ font-style: italic;
+}
+
+strong {
+ font-weight: bold;
+}
+
+tt {
+ color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #527bbd;
+ font-family: sans-serif;
+ margin-top: 1.2em;
+ margin-bottom: 0.5em;
+ line-height: 1.3;
+}
+
+h1 {
+ border-bottom: 2px solid silver;
+}
+h2 {
+ border-bottom: 2px solid silver;
+ padding-top: 0.5em;
+}
+
+div.sectionbody {
+ font-family: serif;
+ margin-left: 0;
+}
+
+hr {
+ border: 1px solid silver;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+pre {
+ padding: 0;
+ margin: 0;
+}
+
+span#author {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ font-size: 1.2em;
+}
+span#email {
+}
+span#revision {
+ font-family: sans-serif;
+}
+
+div#footer {
+ font-family: sans-serif;
+ font-size: small;
+ border-top: 2px solid silver;
+ padding-top: 0.5em;
+ margin-top: 4.0em;
+}
+div#footer-text {
+ float: left;
+ padding-bottom: 0.5em;
+}
+div#footer-badges {
+ float: right;
+ padding-bottom: 0.5em;
+}
+
+div#preamble,
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+ margin-right: 10%;
+ margin-top: 1.5em;
+ margin-bottom: 1.5em;
+}
+div.admonitionblock {
+ margin-top: 2.5em;
+ margin-bottom: 2.5em;
+}
+
+div.content { /* Block element content. */
+ padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+ font-family: sans-serif;
+ font-weight: bold;
+ text-align: left;
+ margin-top: 1.0em;
+ margin-bottom: 0.5em;
+}
+div.title + * {
+ margin-top: 0;
+}
+
+td div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content + div.title {
+ margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+
+div.listingblock > div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock > div.content {
+ padding-left: 2.0em;
+}
+div.quoteblock .attribution {
+ text-align: right;
+}
+
+div.admonitionblock .icon {
+ vertical-align: top;
+ font-size: 1.1em;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #527bbd;
+ padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+ padding-left: 0.5em;
+ border-left: 2px solid silver;
+}
+
+div.exampleblock > div.content {
+ border-left: 2px solid silver;
+ padding: 0.5em;
+}
+
+div.verseblock div.content {
+ white-space: pre;
+}
+
+div.imageblock div.content { padding-left: 0; }
+div.imageblock img { border: 1px solid silver; }
+span.image img { border-style: none; }
+
+dl {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+dt {
+ margin-top: 0.5em;
+ margin-bottom: 0;
+ font-style: italic;
+}
+dd > *:first-child {
+ margin-top: 0;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+ol.olist2 {
+ list-style-type: lower-alpha;
+}
+
+div.tableblock > table {
+ border-color: #527bbd;
+ border-width: 3px;
+}
+thead {
+ font-family: sans-serif;
+ font-weight: bold;
+}
+tfoot {
+ font-weight: bold;
+}
+
+div.hlist {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+td.hlist1 {
+ vertical-align: top;
+ font-style: italic;
+ padding-right: 0.8em;
+}
+td.hlist2 {
+ vertical-align: top;
+}
+
+@media print {
+ div#footer-badges { display: none; }
+}
+include::./stylesheets/xhtml11-manpage.css[]
+/* Workarounds for IE6's broken and incomplete CSS2. */
+
+div.sidebar-content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+div.sidebar-title, div.image-title {
+ font-family: sans-serif;
+ font-weight: bold;
+ margin-top: 0.0em;
+ margin-bottom: 0.5em;
+}
+
+div.listingblock div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock-content {
+ padding-left: 2.0em;
+}
+
+div.exampleblock-content {
+ border-left: 2px solid silver;
+ padding-left: 0.5em;
+}
+</style>
+<title>gitattributes(5)</title>
+</head>
+<body>
+<div id="header">
+<h1>
+gitattributes(5) Manual Page
+</h1>
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>gitattributes -
+ defining attributes per path
+</p>
+</div>
+</div>
+<h2>SYNOPSIS</h2>
+<div class="sectionbody">
+<p>$GIT_DIR/info/attributes, gitattributes</p>
+</div>
+<h2>DESCRIPTION</h2>
+<div class="sectionbody">
+<p>A <tt>gitattributes</tt> file is a simple text file that gives
+<tt>attributes</tt> to pathnames.</p>
+<p>Each line in <tt>gitattributes</tt> file is of form:</p>
+<div class="literalblock">
+<div class="content">
+<pre><tt>glob attr1 attr2 ...</tt></pre>
+</div></div>
+<p>That is, a glob pattern followed by an attributes list,
+separated by whitespaces. When the glob pattern matches the
+path in question, the attributes listed on the line are given to
+the path.</p>
+<p>Each attribute can be in one of these states for a given path:</p>
+<dl>
+<dt>
+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>
+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 <tt>-</tt> in the attribute list.
+</p>
+</dd>
+<dt>
+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 <tt>=</tt> and its value in the
+ attribute list.
+</p>
+</dd>
+<dt>
+Unspecified
+</dt>
+<dd>
+<p>
+ No glob pattern matches the path, and nothing says if
+ the path has or does not have the attribute.
+</p>
+</dd>
+</dl>
+<p>When more than one glob pattern matches the path, a later line
+overrides an earlier line.</p>
+<p>When deciding what attributes are assigned to a path, git
+consults <tt>$GIT_DIR/info/attributes</tt> file (which has the highest
+precedence), <tt>.gitattributes</tt> file in the same directory as the
+path in question, and its parent directories (the further the
+directory that contains <tt>.gitattributes</tt> is from the path in
+question, the lower its precedence).</p>
+<p>Sometimes you would need to override an setting of an attribute
+for a path to <tt>unspecified</tt> state. This can be done by listing
+the name of the attribute prefixed with an exclamation point <tt>!</tt>.</p>
+</div>
+<h2>EFFECTS</h2>
+<div class="sectionbody">
+<p>Certain operations by git can be influenced by assigning
+particular attributes to a path. Currently, three operations
+are attributes-aware.</p>
+<h3>Checking-out and checking-in</h3>
+<p>The attribute <tt>crlf</tt> affects how the contents stored in the
+repository are copied to the working tree files when commands
+such as <tt>git checkout</tt> and <tt>git merge</tt> run. It also affects how
+git stores the contents you prepare in the working tree in the
+repository upon <tt>git add</tt> and <tt>git commit</tt>.</p>
+<dl>
+<dt>
+Set
+</dt>
+<dd>
+<p>
+ Setting the <tt>crlf</tt> attribute on a path is meant to mark
+ the path as a "text" file. <em>core.autocrlf</em> conversion
+ takes place without guessing the content type by
+ inspection.
+</p>
+</dd>
+<dt>
+Unset
+</dt>
+<dd>
+<p>
+ Unsetting the <tt>crlf</tt> attribute on a path is meant to
+ mark the path as a "binary" file. The path never goes
+ through line endings conversion upon checkin/checkout.
+</p>
+</dd>
+<dt>
+Unspecified
+</dt>
+<dd>
+<p>
+ Unspecified <tt>crlf</tt> attribute tells git to apply the
+ <tt>core.autocrlf</tt> conversion when the file content looks
+ like text.
+</p>
+</dd>
+<dt>
+Set to string value "input"
+</dt>
+<dd>
+<p>
+ This is similar to setting the attribute to <tt>true</tt>, but
+ also forces git to act as if <tt>core.autocrlf</tt> is set to
+ <tt>input</tt> for the path.
+</p>
+</dd>
+</dl>
+<p>Any other value set to <tt>crlf</tt> attribute is ignored and git acts
+as if the attribute is left unspecified.</p>
+<h4>The <tt>core.autocrlf</tt> conversion</h4>
+<p>If the configuration variable <tt>core.autocrlf</tt> is false, no
+conversion is done.</p>
+<p>When <tt>core.autocrlf</tt> is true, it means that the platform wants
+CRLF line endings for files in the working tree, and you want to
+convert them back to the normal LF line endings when checking
+in to the repository.</p>
+<p>When <tt>core.autocrlf</tt> is set to "input", line endings are
+converted to LF upon checkin, but there is no conversion done
+upon checkout.</p>
+<h3>Generating diff text</h3>
+<p>The attribute <tt>diff</tt> affects if <tt>git diff</tt> generates textual
+patch for the path or just says <tt>Binary files differ</tt>.</p>
+<dl>
+<dt>
+Set
+</dt>
+<dd>
+<p>
+ A path to which the <tt>diff</tt> 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>
+Unset
+</dt>
+<dd>
+<p>
+ A path to which the <tt>diff</tt> attribute is unset will
+ generate <tt>Binary files differ</tt>.
+</p>
+</dd>
+<dt>
+Unspecified
+</dt>
+<dd>
+<p>
+ A path to which the <tt>diff</tt> attribute is unspecified
+ first gets its contents inspected, and if it looks like
+ text, it is treated as text. Otherwise it would
+ generate <tt>Binary files differ</tt>.
+</p>
+</dd>
+</dl>
+<p>Any other value set to <tt>diff</tt> attribute is ignored and git acts
+as if the attribute is left unspecified.</p>
+<h3>Performing a three-way merge</h3>
+<p>The attribute <tt>merge</tt> affects how three versions of a file is
+merged when a file-level merge is necessary during <tt>git merge</tt>,
+and other programs such as <tt>git revert</tt> and <tt>git cherry-pick</tt>.</p>
+<dl>
+<dt>
+Set
+</dt>
+<dd>
+<p>
+ Built-in 3-way merge driver is used to merge the
+ contents in a way similar to <tt>merge</tt> command of <tt>RCS</tt>
+ suite. This is suitable for ordinary text files.
+</p>
+</dd>
+<dt>
+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 does
+ not have a well-defined merge semantics.
+</p>
+</dd>
+<dt>
+Unspecified
+</dt>
+<dd>
+<p>
+ By default, this uses the same built-in 3-way merge
+ driver as is the case the <tt>merge</tt> attribute is set.
+ However, <tt>merge.default</tt> configuration variable can name
+ different merge driver to be used for paths to which the
+ <tt>merge</tt> attribute is unspecified.
+</p>
+</dd>
+<dt>
+Any other string value
+</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 by "binary".
+</p>
+</dd>
+</dl>
+<h4>Defining a custom merge driver</h4>
+<p>The definition of a merge driver is done in <tt>gitconfig</tt> not
+<tt>gitattributes</tt> file, so strictly speaking this manual page is a
+wrong place to talk about it. However&#8230;</p>
+<p>To define a custom merge driver <tt>filfre</tt>, add a section to your
+<tt>$GIT_DIR/config</tt> file (or <tt>$HOME/.gitconfig</tt> file) like this:</p>
+<div class="listingblock">
+<div class="content">
+<pre><tt>[merge "filfre"]
+ name = feel-free merge driver
+ driver = filfre %O %A %B
+ recursive = binary</tt></pre>
+</div></div>
+<p>The <tt>merge.*.name</tt> variable gives the driver a human-readable
+name.</p>
+<p>The <tt>merge.*.driver</tt> variable's value is used to construct a
+command to run to merge ancestor's version (<tt>%O</tt>), current
+version (<tt>%A</tt>) and the other branches' version (<tt>%B</tt>). These
+three tokens are replaced with the names of temporary files that
+hold the contents of these versions when the command line is
+built.</p>
+<p>The merge driver is expected to leave the result of the merge in
+the file named with <tt>%A</tt> by overwriting it, and exit with zero
+status if it managed to merge them cleanly, or non-zero if there
+were conflicts.</p>
+<p>The <tt>merge.*.recursive</tt> 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>
+<h2>EXAMPLE</h2>
+<div class="sectionbody">
+<p>If you have these three <tt>gitattributes</tt> file:</p>
+<div class="listingblock">
+<div class="content">
+<pre><tt>(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</tt></pre>
+</div></div>
+<p>the attributes given to path <tt>t/abc</tt> are computed as follows:</p>
+<ol>
+<li>
+<p>
+By examining <tt>t/.gitattributes</tt> (which is in the same
+ diretory as the path in question), git finds that the first
+ line matches. <tt>merge</tt> attribute is set. It also finds that
+ the second line matches, and attributes <tt>foo</tt> and <tt>bar</tt>
+ are unset.
+</p>
+</li>
+<li>
+<p>
+Then it examines <tt>.gitattributes</tt> (which is in the parent
+ directory), and finds that the first line matches, but
+ <tt>t/.gitattributes</tt> file already decided how <tt>merge</tt>, <tt>foo</tt>
+ and <tt>bar</tt> attributes should be given to this path, so it
+ leaves <tt>foo</tt> and <tt>bar</tt> unset. Attribute <tt>baz</tt> is set.
+</p>
+</li>
+<li>
+<p>
+Finally it examines <tt>$GIT_DIR/info/gitattributes</tt>. This file
+ is used to override the in-tree settings. The first line is
+ a match, and <tt>foo</tt> is set, <tt>bar</tt> is reverted to unspecified
+ state, and <tt>baz</tt> is unset.
+</p>
+</li>
+</ol>
+<p>As the result, the attributes assignement to <tt>t/abc</tt> becomes:</p>
+<div class="listingblock">
+<div class="content">
+<pre><tt>foo set to true
+bar unspecified
+baz set to false
+merge set to string value "filfre"
+frotz unspecified</tt></pre>
+</div></div>
+</div>
+<h2>GIT</h2>
+<div class="sectionbody">
+<p>Part of the <a href="git.html">git(7)</a> suite</p>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 22-Apr-2007 07:22:00 UTC
+</div>
+</div>
+</body>
+</html>