1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>git-interpret-trailers(
1)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-interpret-trailers(
1) Manual Page
741 <div class=
"sectionbody">
742 <p>git-interpret-trailers -
743 Add or parse structured information in commit messages
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git interpret-trailers
</em> [--in-place] [--trim-empty]
753 [(--trailer
<token
>[(=|:)
<value
>])
…]
754 [--parse] [
<file
>…]
</pre>
755 <div class=
"attribution">
760 <h2 id=
"_description">DESCRIPTION
</h2>
761 <div class=
"sectionbody">
762 <div class=
"paragraph"><p>Add or parse
<em>trailer
</em> lines that look similar to RFC
822 e-mail
763 headers, at the end of the otherwise free-form part of a commit
764 message. For example, in the following commit message
</p></div>
765 <div class=
"listingblock">
766 <div class=
"content">
769 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
771 Signed-off-by: Alice
<alice@example.com
>
772 Signed-off-by: Bob
<bob@example.com
></code></pre>
774 <div class=
"paragraph"><p>the last two lines starting with
"Signed-off-by" are trailers.
</p></div>
775 <div class=
"paragraph"><p>This command reads commit messages from either the
776 <file
> arguments or the standard input if no
<file
> is specified.
777 If
<code>--parse
</code> is specified, the output consists of the parsed trailers.
778 Otherwise, this command applies the arguments passed using the
779 <code>--trailer
</code> option, if any, to each input file. The result is emitted on the
780 standard output.
</p></div>
781 <div class=
"paragraph"><p>This command can also operate on the output of
<a href=
"git-format-patch.html">git-format-patch(
1)
</a>,
782 which is more elaborate than a plain commit message. Namely, such output
783 includes a commit message (as above), a
"---" divider line, and a patch part.
784 For these inputs, the divider and patch parts are not modified by
785 this command and are emitted as is on the output, unless
786 <code>--no-divider
</code> is specified.
</p></div>
787 <div class=
"paragraph"><p>Some configuration variables control the way the
<code>--trailer
</code> arguments
788 are applied to each input and the way any existing trailer in
789 the input is changed. They also make it possible to
790 automatically add some trailers.
</p></div>
791 <div class=
"paragraph"><p>By default, a
<em><token
>=
<value
></em> or
<em><token
>:
<value
></em> argument given
792 using
<code>--trailer
</code> will be appended after the existing trailers only if
793 the last trailer has a different (
<token
>,
<value
>) pair (or if there
794 is no existing trailer). The
<token
> and
<value
> parts will be trimmed
795 to remove starting and trailing whitespace, and the resulting trimmed
796 <token
> and
<value
> will appear in the output like this:
</p></div>
797 <div class=
"listingblock">
798 <div class=
"content">
799 <pre><code>token: value
</code></pre>
801 <div class=
"paragraph"><p>This means that the trimmed
<token
> and
<value
> will be separated by
802 <code>': '
</code> (one colon followed by one space). For convenience, the
<token
> can be a
803 shortened string key (e.g.,
"sign") instead of the full string which should
804 appear before the separator on the output (e.g.,
"Signed-off-by"). This can be
805 configured using the
<em>trailer.
<token
>.key
</em> configuration variable.
</p></div>
806 <div class=
"paragraph"><p>By default the new trailer will appear at the end of all the existing
807 trailers. If there is no existing trailer, the new trailer will appear
808 at the end of the input. A blank line will be added before the new
809 trailer if there isn
’t one already.
</p></div>
810 <div class=
"paragraph"><p>Existing trailers are extracted from the input by looking for
811 a group of one or more lines that (i) is all trailers, or (ii) contains at
812 least one Git-generated or user-configured trailer and consists of at
814 The group must be preceded by one or more empty (or whitespace-only) lines.
815 The group must either be at the end of the input or be the last
816 non-whitespace lines before a line that starts with
<em>---
</em> (followed by a
817 space or the end of the line).
</p></div>
818 <div class=
"paragraph"><p>When reading trailers, there can be no whitespace before or inside the
819 <token
>, but any number of regular space and tab characters are allowed
820 between the
<token
> and the separator. There can be whitespaces before,
821 inside or after the
<value
>. The
<value
> may be split over multiple lines
822 with each subsequent line starting with at least one whitespace, like
823 the
"folding" in RFC
822. Example:
</p></div>
824 <div class=
"listingblock">
825 <div class=
"content">
826 <pre><code>token: This is a very long value, with spaces and
827 newlines in it.
</code></pre>
829 <div class=
"paragraph"><p>Note that trailers do not follow (nor are they intended to follow) many of the
830 rules for RFC
822 headers. For example they do not follow the encoding rule.
</p></div>
834 <h2 id=
"_options">OPTIONS
</h2>
835 <div class=
"sectionbody">
836 <div class=
"dlist"><dl>
842 Edit the files in place.
850 If the
<value
> part of any trailer contains only whitespace,
851 the whole trailer will be removed from the output.
852 This applies to existing trailers as well as new trailers.
856 --trailer
<token
>[(=|:)
<value
>]
860 Specify a (
<token
>,
<value
>) pair that should be applied as a
861 trailer to the inputs. See the description of this
866 --where
<placement
>
873 Specify where all new trailers will be added. A setting
874 provided with
<em>--where
</em> overrides all configuration variables
875 and applies to all
<em>--trailer
</em> options until the next occurrence of
876 <em>--where
</em> or
<em>--no-where
</em>. Possible values are
<code>after
</code>,
<code>before
</code>,
877 <code>end
</code> or
<code>start
</code>.
881 --if-exists
<action
>
888 Specify what action will be performed when there is already at
889 least one trailer with the same
<token
> in the input. A setting
890 provided with
<em>--if-exists
</em> overrides all configuration variables
891 and applies to all
<em>--trailer
</em> options until the next occurrence of
892 <em>--if-exists
</em> or
<em>--no-if-exists
</em>. Possible actions are
<code>addIfDifferent
</code>,
893 <code>addIfDifferentNeighbor
</code>,
<code>add
</code>,
<code>replace
</code> and
<code>doNothing
</code>.
897 --if-missing
<action
>
904 Specify what action will be performed when there is no other
905 trailer with the same
<token
> in the input. A setting
906 provided with
<em>--if-missing
</em> overrides all configuration variables
907 and applies to all
<em>--trailer
</em> options until the next occurrence of
908 <em>--if-missing
</em> or
<em>--no-if-missing
</em>. Possible actions are
<code>doNothing
</code>
917 Output only the trailers, not any other parts of the input.
925 Output only trailers that exist in the input; do not add any
926 from the command-line or by following configured
<code>trailer.*
</code>
935 Remove any whitespace-continuation in trailers, so that each
936 trailer appears on a line by itself with its full content.
944 A convenience alias for
<code>--only-trailers --only-input
953 Do not treat
<code>---
</code> as the end of the commit message. Use this
954 when you know your input contains just the commit message itself
955 (and not an email or the output of
<code>git format-patch
</code>).
962 <h2 id=
"_configuration_variables">CONFIGURATION VARIABLES
</h2>
963 <div class=
"sectionbody">
964 <div class=
"dlist"><dl>
970 This option tells which characters are recognized as trailer
971 separators. By default only
<em>:
</em> is recognized as a trailer
972 separator, except that
<em>=
</em> is always accepted on the command
973 line for compatibility with other git commands.
975 <div class=
"paragraph"><p>The first character given by this option will be the default character
976 used when another separator is not specified in the config for this
978 <div class=
"paragraph"><p>For example, if the value for this option is
"%=$", then only lines
979 using the format
<em><token
><sep
><value
></em> with
<sep
> containing
<em>%
</em>,
<em>=
</em>
980 or
<em>$
</em> and then spaces will be considered trailers. And
<em>%
</em> will be
981 the default separator used, so by default trailers will appear like:
982 <em><token
>%
<value
></em> (one percent sign and one space will appear between
983 the token and the value).
</p></div>
990 This option tells where a new trailer will be added.
992 <div class=
"paragraph"><p>This can be
<code>end
</code>, which is the default,
<code>start
</code>,
<code>after
</code> or
<code>before
</code>.
</p></div>
993 <div class=
"paragraph"><p>If it is
<code>end
</code>, then each new trailer will appear at the end of the
994 existing trailers.
</p></div>
995 <div class=
"paragraph"><p>If it is
<code>start
</code>, then each new trailer will appear at the start,
996 instead of the end, of the existing trailers.
</p></div>
997 <div class=
"paragraph"><p>If it is
<code>after
</code>, then each new trailer will appear just after the
998 last trailer with the same
<token
>.
</p></div>
999 <div class=
"paragraph"><p>If it is
<code>before
</code>, then each new trailer will appear just before the
1000 first trailer with the same
<token
>.
</p></div>
1002 <dt class=
"hdlist1">
1007 This option makes it possible to choose what action will be
1008 performed when there is already at least one trailer with the
1009 same
<token
> in the input.
1011 <div class=
"paragraph"><p>The valid values for this option are:
<code>addIfDifferentNeighbor
</code> (this
1012 is the default),
<code>addIfDifferent
</code>,
<code>add
</code>,
<code>replace
</code> or
<code>doNothing
</code>.
</p></div>
1013 <div class=
"paragraph"><p>With
<code>addIfDifferentNeighbor
</code>, a new trailer will be added only if no
1014 trailer with the same (
<token
>,
<value
>) pair is above or below the line
1015 where the new trailer will be added.
</p></div>
1016 <div class=
"paragraph"><p>With
<code>addIfDifferent
</code>, a new trailer will be added only if no trailer
1017 with the same (
<token
>,
<value
>) pair is already in the input.
</p></div>
1018 <div class=
"paragraph"><p>With
<code>add
</code>, a new trailer will be added, even if some trailers with
1019 the same (
<token
>,
<value
>) pair are already in the input.
</p></div>
1020 <div class=
"paragraph"><p>With
<code>replace
</code>, an existing trailer with the same
<token
> will be
1021 deleted and the new trailer will be added. The deleted trailer will be
1022 the closest one (with the same
<token
>) to the place where the new one
1023 will be added.
</p></div>
1024 <div class=
"paragraph"><p>With
<code>doNothing
</code>, nothing will be done; that is no new trailer will be
1025 added if there is already one with the same
<token
> in the input.
</p></div>
1027 <dt class=
"hdlist1">
1032 This option makes it possible to choose what action will be
1033 performed when there is not yet any trailer with the same
1034 <token
> in the input.
1036 <div class=
"paragraph"><p>The valid values for this option are:
<code>add
</code> (this is the default) and
1037 <code>doNothing
</code>.
</p></div>
1038 <div class=
"paragraph"><p>With
<code>add
</code>, a new trailer will be added.
</p></div>
1039 <div class=
"paragraph"><p>With
<code>doNothing
</code>, nothing will be done.
</p></div>
1041 <dt class=
"hdlist1">
1042 trailer.
<token
>.key
1046 This
<code>key
</code> will be used instead of
<token
> in the trailer. At
1047 the end of this key, a separator can appear and then some
1048 space characters. By default the only valid separator is
<em>:
</em>,
1049 but this can be changed using the
<code>trailer.separators
</code> config
1052 <div class=
"paragraph"><p>If there is a separator, then the key will be used instead of both the
1053 <token
> and the default separator when adding the trailer.
</p></div>
1055 <dt class=
"hdlist1">
1056 trailer.
<token
>.where
1060 This option takes the same values as the
<em>trailer.where
</em>
1061 configuration variable and it overrides what is specified by
1062 that option for trailers with the specified
<token
>.
1065 <dt class=
"hdlist1">
1066 trailer.
<token
>.ifexists
1070 This option takes the same values as the
<em>trailer.ifexists
</em>
1071 configuration variable and it overrides what is specified by
1072 that option for trailers with the specified
<token
>.
1075 <dt class=
"hdlist1">
1076 trailer.
<token
>.ifmissing
1080 This option takes the same values as the
<em>trailer.ifmissing
</em>
1081 configuration variable and it overrides what is specified by
1082 that option for trailers with the specified
<token
>.
1085 <dt class=
"hdlist1">
1086 trailer.
<token
>.command
1090 Deprecated in favor of
<em>trailer.
<token
>.cmd
</em>.
1091 This option behaves in the same way as
<em>trailer.
<token
>.cmd
</em>, except
1092 that it doesn
’t pass anything as argument to the specified command.
1093 Instead the first occurrence of substring $ARG is replaced by the
1094 <value
> that would be passed as argument.
1096 <div class=
"paragraph"><p>Note that $ARG in the user
’s command is
1097 only replaced once and that the original way of replacing $ARG is not safe.
</p></div>
1098 <div class=
"paragraph"><p>When both
<em>trailer.
<token
>.cmd
</em> and
<em>trailer.
<token
>.command
</em> are given
1099 for the same
<token
>,
<em>trailer.
<token
>.cmd
</em> is used and
1100 <em>trailer.
<token
>.command
</em> is ignored.
</p></div>
1102 <dt class=
"hdlist1">
1103 trailer.
<token
>.cmd
1107 This option can be used to specify a shell command that will be called
1108 once to automatically add a trailer with the specified
<token
>, and then
1109 called each time a
<em>--trailer
<token
>=
<value
></em> argument is specified to
1110 modify the
<value
> of the trailer that this option would produce.
1112 <div class=
"paragraph"><p>When the specified command is first called to add a trailer
1113 with the specified
<token
>, the behavior is as if a special
1114 <em>--trailer
<token
>=
<value
></em> argument was added at the beginning
1115 of the
"git interpret-trailers" command, where
<value
>
1116 is taken to be the standard output of the command with any
1117 leading and trailing whitespace trimmed off.
</p></div>
1118 <div class=
"paragraph"><p>If some
<em>--trailer
<token
>=
<value
></em> arguments are also passed
1119 on the command line, the command is called again once for each
1120 of these arguments with the same
<token
>. And the
<value
> part
1121 of these arguments, if any, will be passed to the command as its
1122 first argument. This way the command can produce a
<value
> computed
1123 from the
<value
> passed in the
<em>--trailer
<token
>=
<value
></em> argument.
</p></div>
1129 <h2 id=
"_examples">EXAMPLES
</h2>
1130 <div class=
"sectionbody">
1131 <div class=
"ulist"><ul>
1134 Configure a
<em>sign
</em> trailer with a
<em>Signed-off-by
</em> key, and then
1135 add two of these trailers to a commit message file:
1137 <div class=
"listingblock">
1138 <div class=
"content">
1139 <pre><code>$ git config trailer.sign.key
"Signed-off-by"
1144 $ git interpret-trailers --trailer 'sign: Alice
<alice@example.com
>' --trailer 'sign: Bob
<bob@example.com
>'
<msg.txt
1149 Signed-off-by: Alice
<alice@example.com
>
1150 Signed-off-by: Bob
<bob@example.com
></code></pre>
1155 Use the
<code>--in-place
</code> option to edit a commit message file in place:
1157 <div class=
"listingblock">
1158 <div class=
"content">
1159 <pre><code>$ cat msg.txt
1164 Signed-off-by: Bob
<bob@example.com
>
1165 $ git interpret-trailers --trailer 'Acked-by: Alice
<alice@example.com
>' --in-place msg.txt
1171 Signed-off-by: Bob
<bob@example.com
>
1172 Acked-by: Alice
<alice@example.com
></code></pre>
1177 Extract the last commit as a patch, and add a
<em>Cc
</em> and a
1178 <em>Reviewed-by
</em> trailer to it:
1180 <div class=
"listingblock">
1181 <div class=
"content">
1182 <pre><code>$ git format-patch -
1
1184 $ git interpret-trailers --trailer 'Cc: Alice
<alice@example.com
>' --trailer 'Reviewed-by: Bob
<bob@example.com
>'
0001-foo.patch
>0001-bar.patch
</code></pre>
1189 Configure a
<em>sign
</em> trailer with a command to automatically add a
1190 'Signed-off-by: ' with the author information only if there is no
1191 'Signed-off-by: ' already, and show how it works:
1193 <div class=
"listingblock">
1194 <div class=
"content">
1195 <pre><code>$ cat msg1.txt
1199 $ git config trailer.sign.key
"Signed-off-by: "
1200 $ git config trailer.sign.ifmissing add
1201 $ git config trailer.sign.ifexists doNothing
1202 $ git config trailer.sign.cmd 'echo
"$(git config user.name) <$(git config user.email)>"'
1203 $ git interpret-trailers --trailer sign
<msg1.txt
1208 Signed-off-by: Bob
<bob@example.com
>
1214 Signed-off-by: Alice
<alice@example.com
>
1215 $ git interpret-trailers --trailer sign
<msg2.txt
1220 Signed-off-by: Alice
<alice@example.com
></code></pre>
1225 Configure a
<em>fix
</em> trailer with a key that contains a
<em>#
</em> and no
1226 space after this character, and show how it works:
1228 <div class=
"listingblock">
1229 <div class=
"content">
1230 <pre><code>$ git config trailer.separators
":#"
1231 $ git config trailer.fix.key
"Fix #"
1232 $ echo
"subject" | git interpret-trailers --trailer fix=
42
1235 Fix #
42</code></pre>
1240 Configure a
<em>help
</em> trailer with a cmd use a script
<code>glog-find-author
</code>
1241 which search specified author identity from git log in git repository
1242 and show how it works:
1244 <div class=
"listingblock">
1245 <div class=
"content">
1246 <pre><code>$ cat ~/bin/glog-find-author
1248 test -n
"$1" && git log
--author=
"$1" --pretty=
"%an <%ae>" -
1 || true
1253 $ git config trailer.help.key
"Helped-by: "
1254 $ git config trailer.help.ifExists
"addIfDifferentNeighbor"
1255 $ git config trailer.help.cmd
"~/bin/glog-find-author"
1256 $ git interpret-trailers
--trailer=
"help:Junio" --trailer=
"help:Couder" <msg.txt
1261 Helped-by: Junio C Hamano
<gitster@pobox.com
>
1262 Helped-by: Christian Couder
<christian.couder@gmail.com
></code></pre>
1267 Configure a
<em>ref
</em> trailer with a cmd use a script
<code>glog-grep
</code>
1268 to grep last relevant commit from git log in the git repository
1269 and show how it works:
1271 <div class=
"listingblock">
1272 <div class=
"content">
1273 <pre><code>$ cat ~/bin/glog-grep
1275 test -n
"$1" && git log --grep
"$1" --pretty=reference -
1 || true
1280 $ git config trailer.ref.key
"Reference-to: "
1281 $ git config trailer.ref.ifExists
"replace"
1282 $ git config trailer.ref.cmd
"~/bin/glog-grep"
1283 $ git interpret-trailers
--trailer=
"ref:Add copyright notices." <msg.txt
1288 Reference-to:
8bc9a0c769 (Add copyright notices.,
2005-
04-
07)
</code></pre>
1293 Configure a
<em>see
</em> trailer with a command to show the subject of a
1294 commit that is related, and show how it works:
1296 <div class=
"listingblock">
1297 <div class=
"content">
1298 <pre><code>$ cat msg.txt
1304 $ cat ~/bin/glog-ref
1306 git log -
1 --oneline
--format=
"%h (%s)" --abbrev-commit --abbrev=
14
1307 $ git config trailer.see.key
"See-also: "
1308 $ git config trailer.see.ifExists
"replace"
1309 $ git config trailer.see.ifMissing
"doNothing"
1310 $ git config trailer.see.cmd
"glog-ref"
1311 $ git interpret-trailers --trailer=see
<msg.txt
1316 See-also: fe3187489d69c4 (subject of related commit)
</code></pre>
1321 Configure a commit template with some trailers with empty values
1322 (using sed to show and keep the trailing spaces at the end of the
1323 trailers), then configure a commit-msg hook that uses
1324 <em>git interpret-trailers
</em> to remove trailers with empty values and
1325 to add a
<em>git-version
</em> trailer:
1327 <div class=
"listingblock">
1328 <div class=
"content">
1329 <pre><code>$ cat temp.txt
1338 $ sed -e 's/ Z$/ /' temp.txt
> commit_template.txt
1339 $ git config commit.template commit_template.txt
1340 $ cat .git/hooks/commit-msg
1342 git interpret-trailers --trim-empty --trailer
"git-version: \$(git describe)" "\$1" > "\$1.new"
1344 $ chmod +x .git/hooks/commit-msg
</code></pre>
1351 <h2 id=
"_see_also">SEE ALSO
</h2>
1352 <div class=
"sectionbody">
1353 <div class=
"paragraph"><p><a href=
"git-commit.html">git-commit(
1)
</a>,
<a href=
"git-format-patch.html">git-format-patch(
1)
</a>,
<a href=
"git-config.html">git-config(
1)
</a></p></div>
1357 <h2 id=
"_git">GIT
</h2>
1358 <div class=
"sectionbody">
1359 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1363 <div id=
"footnotes"><hr /></div>
1365 <div id=
"footer-text">
1367 2023-
06-
23 13:
24:
09 PDT