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 (
<key
>|
<keyAlias
>)[(=|:)
<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 coming from the input, without influencing them with any command line
779 options or configuration variables.
</p></div>
780 <div class=
"paragraph"><p>Otherwise, this command applies
<code>trailer.*
</code> configuration variables
781 (which could potentially add new trailers, as well as reposition them),
782 as well as any command line arguments that can override configuration
783 variables (such as
<code>--trailer=...
</code> which could also add new trailers),
784 to each input file. The result is emitted on the standard output.
</p></div>
785 <div class=
"paragraph"><p>This command can also operate on the output of
<a href=
"git-format-patch.html">git-format-patch(
1)
</a>,
786 which is more elaborate than a plain commit message. Namely, such output
787 includes a commit message (as above), a
"---" divider line, and a patch part.
788 For these inputs, the divider and patch parts are not modified by
789 this command and are emitted as is on the output, unless
790 <code>--no-divider
</code> is specified.
</p></div>
791 <div class=
"paragraph"><p>Some configuration variables control the way the
<code>--trailer
</code> arguments
792 are applied to each input and the way any existing trailer in
793 the input is changed. They also make it possible to
794 automatically add some trailers.
</p></div>
795 <div class=
"paragraph"><p>By default, a
<em><key
>=
<value
></em> or
<em><key
>:
<value
></em> argument given
796 using
<code>--trailer
</code> will be appended after the existing trailers only if
797 the last trailer has a different (
<key
>,
<value
>) pair (or if there
798 is no existing trailer). The
<key
> and
<value
> parts will be trimmed
799 to remove starting and trailing whitespace, and the resulting trimmed
800 <key
> and
<value
> will appear in the output like this:
</p></div>
801 <div class=
"listingblock">
802 <div class=
"content">
803 <pre><code>key: value
</code></pre>
805 <div class=
"paragraph"><p>This means that the trimmed
<key
> and
<value
> will be separated by
806 <code>': '
</code> (one colon followed by one space).
</p></div>
807 <div class=
"paragraph"><p>For convenience, a
<keyAlias
> can be configured to make using
<code>--trailer
</code>
808 shorter to type on the command line. This can be configured using the
809 <em>trailer.
<keyAlias
>.key
</em> configuration variable. The
<keyAlias
> must be a prefix
810 of the full
<key
> string, although case sensitivity does not matter. For
811 example, if you have
</p></div>
812 <div class=
"listingblock">
813 <div class=
"content">
814 <pre><code>trailer.sign.key
"Signed-off-by: "</code></pre>
816 <div class=
"paragraph"><p>in your configuration, you only need to specify
<code>--trailer=
"sign: foo"</code>
817 on the command line instead of
<code>--trailer=
"Signed-off-by: foo"</code>.
</p></div>
818 <div class=
"paragraph"><p>By default the new trailer will appear at the end of all the existing
819 trailers. If there is no existing trailer, the new trailer will appear
820 at the end of the input. A blank line will be added before the new
821 trailer if there isn
’t one already.
</p></div>
822 <div class=
"paragraph"><p>Existing trailers are extracted from the input by looking for
823 a group of one or more lines that (i) is all trailers, or (ii) contains at
824 least one Git-generated or user-configured trailer and consists of at
826 The group must be preceded by one or more empty (or whitespace-only) lines.
827 The group must either be at the end of the input or be the last
828 non-whitespace lines before a line that starts with
<em>---
</em> (followed by a
829 space or the end of the line).
</p></div>
830 <div class=
"paragraph"><p>When reading trailers, there can be no whitespace before or inside the
831 <key
>, but any number of regular space and tab characters are allowed
832 between the
<key
> and the separator. There can be whitespaces before,
833 inside or after the
<value
>. The
<value
> may be split over multiple lines
834 with each subsequent line starting with at least one whitespace, like
835 the
"folding" in RFC
822. Example:
</p></div>
836 <div class=
"listingblock">
837 <div class=
"content">
838 <pre><code>key: This is a very long value, with spaces and
839 newlines in it.
</code></pre>
841 <div class=
"paragraph"><p>Note that trailers do not follow (nor are they intended to follow) many of the
842 rules for RFC
822 headers. For example they do not follow the encoding rule.
</p></div>
846 <h2 id=
"_options">OPTIONS
</h2>
847 <div class=
"sectionbody">
848 <div class=
"dlist"><dl>
854 Edit the files in place.
862 If the
<value
> part of any trailer contains only whitespace,
863 the whole trailer will be removed from the output.
864 This applies to existing trailers as well as new trailers.
868 --trailer
<key
>[(=|:)
<value
>]
872 Specify a (
<key
>,
<value
>) pair that should be applied as a
873 trailer to the inputs. See the description of this
878 --where
<placement
>
885 Specify where all new trailers will be added. A setting
886 provided with
<em>--where
</em> overrides the
<code>trailer.where
</code> and any
887 applicable
<code>trailer.
<keyAlias
>.where
</code> configuration variables
888 and applies to all
<em>--trailer
</em> options until the next occurrence of
889 <em>--where
</em> or
<em>--no-where
</em>. Upon encountering
<em>--no-where
</em>, clear the
890 effect of any previous use of
<em>--where
</em>, such that the relevant configuration
891 variables are no longer overridden. Possible placements are
<code>after
</code>,
892 <code>before
</code>,
<code>end
</code> or
<code>start
</code>.
896 --if-exists
<action
>
903 Specify what action will be performed when there is already at
904 least one trailer with the same
<key
> in the input. A setting
905 provided with
<em>--if-exists
</em> overrides the
<code>trailer.ifExists
</code> and any
906 applicable
<code>trailer.
<keyAlias
>.ifExists
</code> configuration variables
907 and applies to all
<em>--trailer
</em> options until the next occurrence of
908 <em>--if-exists
</em> or
<em>--no-if-exists
</em>. Upon encountering '--no-if-exists, clear the
909 effect of any previous use of '--if-exists, such that the relevant configuration
910 variables are no longer overridden. Possible actions are
<code>addIfDifferent
</code>,
911 <code>addIfDifferentNeighbor
</code>,
<code>add
</code>,
<code>replace
</code> and
<code>doNothing
</code>.
915 --if-missing
<action
>
922 Specify what action will be performed when there is no other
923 trailer with the same
<key
> in the input. A setting
924 provided with
<em>--if-missing
</em> overrides the
<code>trailer.ifMissing
</code> and any
925 applicable
<code>trailer.
<keyAlias
>.ifMissing
</code> configuration variables
926 and applies to all
<em>--trailer
</em> options until the next occurrence of
927 <em>--if-missing
</em> or
<em>--no-if-missing
</em>. Upon encountering '--no-if-missing,
928 clear the effect of any previous use of '--if-missing, such that the relevant
929 configuration variables are no longer overridden. Possible actions are
<code>doNothing
</code>
938 Output only the trailers, not any other parts of the input.
946 Output only trailers that exist in the input; do not add any
947 from the command-line or by applying
<code>trailer.*
</code> configuration
956 If a trailer has a value that runs over multiple lines (aka
"folded"),
957 reformat the value into a single line.
965 A convenience alias for
<code>--only-trailers --only-input
966 --unfold
</code>. This makes it easier to only see the trailers coming from the
967 input without influencing them with any command line options or
968 configuration variables, while also making the output machine-friendly with
977 Do not treat
<code>---
</code> as the end of the commit message. Use this
978 when you know your input contains just the commit message itself
979 (and not an email or the output of
<code>git format-patch
</code>).
986 <h2 id=
"_configuration_variables">CONFIGURATION VARIABLES
</h2>
987 <div class=
"sectionbody">
988 <div class=
"dlist"><dl>
994 This option tells which characters are recognized as trailer
995 separators. By default only
<em>:
</em> is recognized as a trailer
996 separator, except that
<em>=
</em> is always accepted on the command
997 line for compatibility with other git commands.
999 <div class=
"paragraph"><p>The first character given by this option will be the default character
1000 used when another separator is not specified in the config for this
1002 <div class=
"paragraph"><p>For example, if the value for this option is
"%=$", then only lines
1003 using the format
<em><key
><sep
><value
></em> with
<sep
> containing
<em>%
</em>,
<em>=
</em>
1004 or
<em>$
</em> and then spaces will be considered trailers. And
<em>%
</em> will be
1005 the default separator used, so by default trailers will appear like:
1006 <em><key
>%
<value
></em> (one percent sign and one space will appear between
1007 the key and the value).
</p></div>
1009 <dt class=
"hdlist1">
1014 This option tells where a new trailer will be added.
1016 <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>
1017 <div class=
"paragraph"><p>If it is
<code>end
</code>, then each new trailer will appear at the end of the
1018 existing trailers.
</p></div>
1019 <div class=
"paragraph"><p>If it is
<code>start
</code>, then each new trailer will appear at the start,
1020 instead of the end, of the existing trailers.
</p></div>
1021 <div class=
"paragraph"><p>If it is
<code>after
</code>, then each new trailer will appear just after the
1022 last trailer with the same
<key
>.
</p></div>
1023 <div class=
"paragraph"><p>If it is
<code>before
</code>, then each new trailer will appear just before the
1024 first trailer with the same
<key
>.
</p></div>
1026 <dt class=
"hdlist1">
1031 This option makes it possible to choose what action will be
1032 performed when there is already at least one trailer with the
1033 same
<key
> in the input.
1035 <div class=
"paragraph"><p>The valid values for this option are:
<code>addIfDifferentNeighbor
</code> (this
1036 is the default),
<code>addIfDifferent
</code>,
<code>add
</code>,
<code>replace
</code> or
<code>doNothing
</code>.
</p></div>
1037 <div class=
"paragraph"><p>With
<code>addIfDifferentNeighbor
</code>, a new trailer will be added only if no
1038 trailer with the same (
<key
>,
<value
>) pair is above or below the line
1039 where the new trailer will be added.
</p></div>
1040 <div class=
"paragraph"><p>With
<code>addIfDifferent
</code>, a new trailer will be added only if no trailer
1041 with the same (
<key
>,
<value
>) pair is already in the input.
</p></div>
1042 <div class=
"paragraph"><p>With
<code>add
</code>, a new trailer will be added, even if some trailers with
1043 the same (
<key
>,
<value
>) pair are already in the input.
</p></div>
1044 <div class=
"paragraph"><p>With
<code>replace
</code>, an existing trailer with the same
<key
> will be
1045 deleted and the new trailer will be added. The deleted trailer will be
1046 the closest one (with the same
<key
>) to the place where the new one
1047 will be added.
</p></div>
1048 <div class=
"paragraph"><p>With
<code>doNothing
</code>, nothing will be done; that is no new trailer will be
1049 added if there is already one with the same
<key
> in the input.
</p></div>
1051 <dt class=
"hdlist1">
1056 This option makes it possible to choose what action will be
1057 performed when there is not yet any trailer with the same
1058 <key
> in the input.
1060 <div class=
"paragraph"><p>The valid values for this option are:
<code>add
</code> (this is the default) and
1061 <code>doNothing
</code>.
</p></div>
1062 <div class=
"paragraph"><p>With
<code>add
</code>, a new trailer will be added.
</p></div>
1063 <div class=
"paragraph"><p>With
<code>doNothing
</code>, nothing will be done.
</p></div>
1065 <dt class=
"hdlist1">
1066 trailer.
<keyAlias
>.key
1070 Defines a
<keyAlias
> for the
<key
>. The
<keyAlias
> must be a
1071 prefix (case does not matter) of the
<key
>. For example, in
<code>git
1072 config trailer.ack.key
"Acked-by"</code> the
"Acked-by" is the
<key
> and
1073 the
"ack" is the
<keyAlias
>. This configuration allows the shorter
1074 <code>--trailer
"ack:..."</code> invocation on the command line using the
"ack"
1075 <keyAlias
> instead of the longer
<code>--trailer
"Acked-by:..."</code>.
1077 <div class=
"paragraph"><p>At the end of the
<key
>, a separator can appear and then some
1078 space characters. By default the only valid separator is
<em>:
</em>,
1079 but this can be changed using the
<code>trailer.separators
</code> config
1081 <div class=
"paragraph"><p>If there is a separator in the key, then it overrides the default
1082 separator when adding the trailer.
</p></div>
1084 <dt class=
"hdlist1">
1085 trailer.
<keyAlias
>.where
1089 This option takes the same values as the
<em>trailer.where
</em>
1090 configuration variable and it overrides what is specified by
1091 that option for trailers with the specified
<keyAlias
>.
1094 <dt class=
"hdlist1">
1095 trailer.
<keyAlias
>.ifexists
1099 This option takes the same values as the
<em>trailer.ifexists
</em>
1100 configuration variable and it overrides what is specified by
1101 that option for trailers with the specified
<keyAlias
>.
1104 <dt class=
"hdlist1">
1105 trailer.
<keyAlias
>.ifmissing
1109 This option takes the same values as the
<em>trailer.ifmissing
</em>
1110 configuration variable and it overrides what is specified by
1111 that option for trailers with the specified
<keyAlias
>.
1114 <dt class=
"hdlist1">
1115 trailer.
<keyAlias
>.command
1119 Deprecated in favor of
<em>trailer.
<keyAlias
>.cmd
</em>.
1120 This option behaves in the same way as
<em>trailer.
<keyAlias
>.cmd
</em>, except
1121 that it doesn
’t pass anything as argument to the specified command.
1122 Instead the first occurrence of substring $ARG is replaced by the
1123 <value
> that would be passed as argument.
1125 <div class=
"paragraph"><p>Note that $ARG in the user
’s command is
1126 only replaced once and that the original way of replacing $ARG is not safe.
</p></div>
1127 <div class=
"paragraph"><p>When both
<em>trailer.
<keyAlias
>.cmd
</em> and
<em>trailer.
<keyAlias
>.command
</em> are given
1128 for the same
<keyAlias
>,
<em>trailer.
<keyAlias
>.cmd
</em> is used and
1129 <em>trailer.
<keyAlias
>.command
</em> is ignored.
</p></div>
1131 <dt class=
"hdlist1">
1132 trailer.
<keyAlias
>.cmd
1136 This option can be used to specify a shell command that will be called
1137 once to automatically add a trailer with the specified
<keyAlias
>, and then
1138 called each time a
<em>--trailer
<keyAlias
>=
<value
></em> argument is specified to
1139 modify the
<value
> of the trailer that this option would produce.
1141 <div class=
"paragraph"><p>When the specified command is first called to add a trailer
1142 with the specified
<keyAlias
>, the behavior is as if a special
1143 <em>--trailer
<keyAlias
>=
<value
></em> argument was added at the beginning
1144 of the
"git interpret-trailers" command, where
<value
>
1145 is taken to be the standard output of the command with any
1146 leading and trailing whitespace trimmed off.
</p></div>
1147 <div class=
"paragraph"><p>If some
<em>--trailer
<keyAlias
>=
<value
></em> arguments are also passed
1148 on the command line, the command is called again once for each
1149 of these arguments with the same
<keyAlias
>. And the
<value
> part
1150 of these arguments, if any, will be passed to the command as its
1151 first argument. This way the command can produce a
<value
> computed
1152 from the
<value
> passed in the
<em>--trailer
<keyAlias
>=
<value
></em> argument.
</p></div>
1158 <h2 id=
"_examples">EXAMPLES
</h2>
1159 <div class=
"sectionbody">
1160 <div class=
"ulist"><ul>
1163 Configure a
<em>sign
</em> trailer with a
<em>Signed-off-by
</em> key, and then
1164 add two of these trailers to a commit message file:
1166 <div class=
"listingblock">
1167 <div class=
"content">
1168 <pre><code>$ git config trailer.sign.key
"Signed-off-by"
1173 $ git interpret-trailers --trailer 'sign: Alice
<alice@example.com
>' --trailer 'sign: Bob
<bob@example.com
>'
<msg.txt
1178 Signed-off-by: Alice
<alice@example.com
>
1179 Signed-off-by: Bob
<bob@example.com
></code></pre>
1184 Use the
<code>--in-place
</code> option to edit a commit message file in place:
1186 <div class=
"listingblock">
1187 <div class=
"content">
1188 <pre><code>$ cat msg.txt
1193 Signed-off-by: Bob
<bob@example.com
>
1194 $ git interpret-trailers --trailer 'Acked-by: Alice
<alice@example.com
>' --in-place msg.txt
1200 Signed-off-by: Bob
<bob@example.com
>
1201 Acked-by: Alice
<alice@example.com
></code></pre>
1206 Extract the last commit as a patch, and add a
<em>Cc
</em> and a
1207 <em>Reviewed-by
</em> trailer to it:
1209 <div class=
"listingblock">
1210 <div class=
"content">
1211 <pre><code>$ git format-patch -
1
1213 $ git interpret-trailers --trailer 'Cc: Alice
<alice@example.com
>' --trailer 'Reviewed-by: Bob
<bob@example.com
>'
0001-foo.patch
>0001-bar.patch
</code></pre>
1218 Configure a
<em>sign
</em> trailer with a command to automatically add a
1219 'Signed-off-by: ' with the author information only if there is no
1220 'Signed-off-by: ' already, and show how it works:
1222 <div class=
"listingblock">
1223 <div class=
"content">
1224 <pre><code>$ cat msg1.txt
1228 $ git config trailer.sign.key
"Signed-off-by: "
1229 $ git config trailer.sign.ifmissing add
1230 $ git config trailer.sign.ifexists doNothing
1231 $ git config trailer.sign.cmd 'echo
"$(git config user.name) <$(git config user.email)>"'
1232 $ git interpret-trailers --trailer sign
<msg1.txt
1237 Signed-off-by: Bob
<bob@example.com
>
1243 Signed-off-by: Alice
<alice@example.com
>
1244 $ git interpret-trailers --trailer sign
<msg2.txt
1249 Signed-off-by: Alice
<alice@example.com
></code></pre>
1254 Configure a
<em>fix
</em> trailer with a key that contains a
<em>#
</em> and no
1255 space after this character, and show how it works:
1257 <div class=
"listingblock">
1258 <div class=
"content">
1259 <pre><code>$ git config trailer.separators
":#"
1260 $ git config trailer.fix.key
"Fix #"
1261 $ echo
"subject" | git interpret-trailers --trailer fix=
42
1264 Fix #
42</code></pre>
1269 Configure a
<em>help
</em> trailer with a cmd use a script
<code>glog-find-author
</code>
1270 which search specified author identity from git log in git repository
1271 and show how it works:
1273 <div class=
"listingblock">
1274 <div class=
"content">
1275 <pre><code>$ cat ~/bin/glog-find-author
1277 test -n
"$1" && git log
--author=
"$1" --pretty=
"%an <%ae>" -
1 || true
1282 $ git config trailer.help.key
"Helped-by: "
1283 $ git config trailer.help.ifExists
"addIfDifferentNeighbor"
1284 $ git config trailer.help.cmd
"~/bin/glog-find-author"
1285 $ git interpret-trailers
--trailer=
"help:Junio" --trailer=
"help:Couder" <msg.txt
1290 Helped-by: Junio C Hamano
<gitster@pobox.com
>
1291 Helped-by: Christian Couder
<christian.couder@gmail.com
></code></pre>
1296 Configure a
<em>ref
</em> trailer with a cmd use a script
<code>glog-grep
</code>
1297 to grep last relevant commit from git log in the git repository
1298 and show how it works:
1300 <div class=
"listingblock">
1301 <div class=
"content">
1302 <pre><code>$ cat ~/bin/glog-grep
1304 test -n
"$1" && git log --grep
"$1" --pretty=reference -
1 || true
1309 $ git config trailer.ref.key
"Reference-to: "
1310 $ git config trailer.ref.ifExists
"replace"
1311 $ git config trailer.ref.cmd
"~/bin/glog-grep"
1312 $ git interpret-trailers
--trailer=
"ref:Add copyright notices." <msg.txt
1317 Reference-to:
8bc9a0c769 (Add copyright notices.,
2005-
04-
07)
</code></pre>
1322 Configure a
<em>see
</em> trailer with a command to show the subject of a
1323 commit that is related, and show how it works:
1325 <div class=
"listingblock">
1326 <div class=
"content">
1327 <pre><code>$ cat msg.txt
1333 $ cat ~/bin/glog-ref
1335 git log -
1 --oneline
--format=
"%h (%s)" --abbrev-commit --abbrev=
14
1336 $ git config trailer.see.key
"See-also: "
1337 $ git config trailer.see.ifExists
"replace"
1338 $ git config trailer.see.ifMissing
"doNothing"
1339 $ git config trailer.see.cmd
"glog-ref"
1340 $ git interpret-trailers --trailer=see
<msg.txt
1345 See-also: fe3187489d69c4 (subject of related commit)
</code></pre>
1350 Configure a commit template with some trailers with empty values
1351 (using sed to show and keep the trailing spaces at the end of the
1352 trailers), then configure a commit-msg hook that uses
1353 <em>git interpret-trailers
</em> to remove trailers with empty values and
1354 to add a
<em>git-version
</em> trailer:
1356 <div class=
"listingblock">
1357 <div class=
"content">
1358 <pre><code>$ cat temp.txt
1367 $ sed -e 's/ Z$/ /' temp.txt
> commit_template.txt
1368 $ git config commit.template commit_template.txt
1369 $ cat .git/hooks/commit-msg
1371 git interpret-trailers --trim-empty --trailer
"git-version: \$(git describe)" "\$1" > "\$1.new"
1373 $ chmod +x .git/hooks/commit-msg
</code></pre>
1380 <h2 id=
"_see_also">SEE ALSO
</h2>
1381 <div class=
"sectionbody">
1382 <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>
1386 <h2 id=
"_git">GIT
</h2>
1387 <div class=
"sectionbody">
1388 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1392 <div id=
"footnotes"><hr /></div>
1394 <div id=
"footer-text">
1396 2023-
10-
13 15:
25:
25 PDT