blob: e8dfa32797696aa6781f17831e388c45e7f06ee3 [file] [log] [blame]
Junio C Hamano4c43d652014-10-20 21:14:291<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6<meta name="generator" content="AsciiDoc 8.6.9" />
7<title>git-interpret-trailers(1)</title>
8<style type="text/css">
9/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
24}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
30a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
37
38em {
39 font-style: italic;
40 color: navy;
41}
42
43strong {
44 font-weight: bold;
45 color: #083194;
46}
47
48h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
50 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
55h1, h2, h3 {
56 border-bottom: 2px solid silver;
57}
58h2 {
59 padding-top: 0.5em;
60}
61h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
67h5 {
68 font-size: 1.0em;
69}
70
71div.sectionbody {
72 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
84ul, ol, li > p {
85 margin-top: 0;
86}
87ul > li { color: #aaa; }
88ul > li > * { color: black; }
89
90.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
94 padding: 0;
95 margin: 0;
96}
97pre {
98 white-space: pre-wrap;
99}
100
101#author {
102 color: #527bbd;
103 font-weight: bold;
104 font-size: 1.1em;
105}
106#email {
107}
108#revnumber, #revdate, #revremark {
109}
110
111#footer {
112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
117#footer-text {
118 float: left;
119 padding-bottom: 0.5em;
120}
121#footer-badges {
122 float: right;
123 padding-bottom: 0.5em;
124}
125
126#preamble {
127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
130div.imageblock, div.exampleblock, div.verseblock,
131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
133 margin-top: 1.0em;
134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
149 color: #527bbd;
150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
180 padding: 0.5em;
181}
182
183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
186 margin-right: 10%;
187 border-left: 5px solid #f0f0f0;
188 color: #888;
189}
190
191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
193 text-align: right;
194}
195
196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
205div.verseblock + div.attribution {
206 text-align: left;
207}
208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
219 border-left: 3px solid #dddddd;
220}
221
222div.exampleblock > div.content {
223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
225}
226
227div.imageblock div.content { padding-left: 0; }
228span.image img { border-style: none; vertical-align: text-bottom; }
229a.image:visited { color: white; }
230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
238 font-style: normal;
239 color: navy;
240}
241dd > *:first-child {
242 margin-top: 0.1em;
243}
244
245ul, ol {
246 list-style-position: outside;
247}
248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
252 list-style-type: lower-alpha;
253}
254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
270
271tfoot {
272 font-weight: bold;
273}
274td > div.verse {
275 white-space: pre;
276}
277
278div.hdlist {
279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
282div.hdlist tr {
283 padding-bottom: 15px;
284}
285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
289 vertical-align: top;
290 font-style: normal;
291 padding-right: 0.8em;
292 color: navy;
293}
294td.hdlist2 {
295 vertical-align: top;
296}
297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
305
306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
340}
341
342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
347 margin-bottom: 2.5em;
348}
349
350#toctitle {
351 color: #527bbd;
352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
416div.unbreakable { page-break-inside: avoid; }
417
418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
526body.manpage h2 {
527 border-style: none;
528}
529body.manpage div.sectionbody {
530 margin-left: 3em;
531}
532
533@media print {
534 body.manpage div#toc { display: none; }
535}
536
537
538</style>
539<script type="text/javascript">
540/*<![CDATA[*/
541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
611 if (entry.nodeName.toLowerCase() == 'div'
612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
650 var noteholder = document.getElementById("footnotes");
651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
727}
728
729}
730asciidoc.install();
731/*]]>*/
732</script>
733</head>
734<body class="manpage">
735<div id="header">
736<h1>
737git-interpret-trailers(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-interpret-trailers -
Junio C Hamanofb5ffde2014-11-04 22:38:56742 help add structured information into commit messages
Junio C Hamano4c43d652014-10-20 21:14:29743</p>
744</div>
745</div>
746<div id="content">
747<div class="sect1">
748<h2 id="_synopsis">SYNOPSIS</h2>
749<div class="sectionbody">
750<div class="verseblock">
Junio C Hamano7d098642016-01-30 00:05:21751<pre class="content"><em>git interpret-trailers</em> [--in-place] [--trim-empty] [(--trailer &lt;token&gt;[(=|:)&lt;value&gt;])&#8230;] [&lt;file&gt;&#8230;]</pre>
Junio C Hamano4c43d652014-10-20 21:14:29752<div class="attribution">
753</div></div>
754</div>
755</div>
756<div class="sect1">
757<h2 id="_description">DESCRIPTION</h2>
758<div class="sectionbody">
759<div class="paragraph"><p>Help adding <em>trailers</em> lines, that look similar to RFC 822 e-mail
760headers, at the end of the otherwise free-form part of a commit
761message.</p></div>
762<div class="paragraph"><p>This command reads some patches or commit messages from either the
763&lt;file&gt; arguments or the standard input if no &lt;file&gt; is specified. Then
764this command applies the arguments passed using the <code>--trailer</code>
765option, if any, to the commit message part of each input file. The
766result is emitted on the standard output.</p></div>
767<div class="paragraph"><p>Some configuration variables control the way the <code>--trailer</code> arguments
768are applied to each commit message and the way any existing trailer in
769the commit message is changed. They also make it possible to
770automatically add some trailers.</p></div>
771<div class="paragraph"><p>By default, a <em>&lt;token&gt;=&lt;value&gt;</em> or <em>&lt;token&gt;:&lt;value&gt;</em> argument given
772using <code>--trailer</code> will be appended after the existing trailers only if
773the last trailer has a different (&lt;token&gt;, &lt;value&gt;) pair (or if there
774is no existing trailer). The &lt;token&gt; and &lt;value&gt; parts will be trimmed
775to remove starting and trailing whitespace, and the resulting trimmed
776&lt;token&gt; and &lt;value&gt; will appear in the message like this:</p></div>
777<div class="listingblock">
778<div class="content">
779<pre><code>token: value</code></pre>
780</div></div>
781<div class="paragraph"><p>This means that the trimmed &lt;token&gt; and &lt;value&gt; will be separated by
782<code>': '</code> (one colon followed by one space).</p></div>
783<div class="paragraph"><p>By default the new trailer will appear at the end of all the existing
784trailers. If there is no existing trailer, the new trailer will appear
Junio C Hamanofb5ffde2014-11-04 22:38:56785after the commit message part of the output, and, if there is no line
Junio C Hamano4c43d652014-10-20 21:14:29786with only spaces at the end of the commit message part, one blank line
787will be added before the new trailer.</p></div>
788<div class="paragraph"><p>Existing trailers are extracted from the input message by looking for
Junio C Hamanof2f28b12016-10-31 21:41:58789a group of one or more lines that (i) are all trailers, or (ii) contains at
Junio C Hamanoca785492016-11-23 20:12:30790least one Git-generated or user-configured trailer and consists of at
791least 25% trailers.
Junio C Hamanof2f28b12016-10-31 21:41:58792The group must be preceded by one or more empty (or whitespace-only) lines.
Junio C Hamano4c43d652014-10-20 21:14:29793The group must either be at the end of the message or be the last
794non-whitespace lines before a line that starts with <em>---</em>. Such three
795minus signs start the patch part of the message.</p></div>
Junio C Hamanof2f28b12016-10-31 21:41:58796<div class="paragraph"><p>When reading trailers, there can be whitespaces after the
Junio C Hamano4c43d652014-10-20 21:14:29797token, the separator and the value. There can also be whitespaces
Junio C Hamanof2f28b12016-10-31 21:41:58798inside the token and the value. The value may be split over multiple lines with
799each subsequent line starting with whitespace, like the "folding" in RFC 822.</p></div>
Junio C Hamano4c43d652014-10-20 21:14:29800<div class="paragraph"><p>Note that <em>trailers</em> do not follow and are not intended to follow many
Junio C Hamanof2f28b12016-10-31 21:41:58801rules for RFC 822 headers. For example they do not follow
802the encoding rules and probably many other rules.</p></div>
Junio C Hamano4c43d652014-10-20 21:14:29803</div>
804</div>
805<div class="sect1">
806<h2 id="_options">OPTIONS</h2>
807<div class="sectionbody">
808<div class="dlist"><dl>
809<dt class="hdlist1">
Junio C Hamano7d098642016-01-30 00:05:21810--in-place
811</dt>
812<dd>
813<p>
814 Edit the files in place.
815</p>
816</dd>
817<dt class="hdlist1">
Junio C Hamano4c43d652014-10-20 21:14:29818--trim-empty
819</dt>
820<dd>
821<p>
822 If the &lt;value&gt; part of any trailer contains only whitespace,
823 the whole trailer will be removed from the resulting message.
Junio C Hamanob0a1e832015-10-15 23:08:31824 This applies to existing trailers as well as new trailers.
Junio C Hamano4c43d652014-10-20 21:14:29825</p>
826</dd>
827<dt class="hdlist1">
828--trailer &lt;token&gt;[(=|:)&lt;value&gt;]
829</dt>
830<dd>
831<p>
832 Specify a (&lt;token&gt;, &lt;value&gt;) pair that should be applied as a
833 trailer to the input messages. See the description of this
834 command.
835</p>
836</dd>
837</dl></div>
838</div>
839</div>
840<div class="sect1">
841<h2 id="_configuration_variables">CONFIGURATION VARIABLES</h2>
842<div class="sectionbody">
843<div class="dlist"><dl>
844<dt class="hdlist1">
845trailer.separators
846</dt>
847<dd>
848<p>
849 This option tells which characters are recognized as trailer
850 separators. By default only <em>:</em> is recognized as a trailer
851 separator, except that <em>=</em> is always accepted on the command
852 line for compatibility with other git commands.
853</p>
854<div class="paragraph"><p>The first character given by this option will be the default character
855used when another separator is not specified in the config for this
856trailer.</p></div>
857<div class="paragraph"><p>For example, if the value for this option is "%=$", then only lines
858using the format <em>&lt;token&gt;&lt;sep&gt;&lt;value&gt;</em> with &lt;sep&gt; containing <em>%</em>, <em>=</em>
859or <em>$</em> and then spaces will be considered trailers. And <em>%</em> will be
860the default separator used, so by default trailers will appear like:
861<em>&lt;token&gt;% &lt;value&gt;</em> (one percent sign and one space will appear between
862the token and the value).</p></div>
863</dd>
864<dt class="hdlist1">
865trailer.where
866</dt>
867<dd>
868<p>
869 This option tells where a new trailer will be added.
870</p>
871<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>
872<div class="paragraph"><p>If it is <code>end</code>, then each new trailer will appear at the end of the
873existing trailers.</p></div>
874<div class="paragraph"><p>If it is <code>start</code>, then each new trailer will appear at the start,
875instead of the end, of the existing trailers.</p></div>
876<div class="paragraph"><p>If it is <code>after</code>, then each new trailer will appear just after the
877last trailer with the same &lt;token&gt;.</p></div>
878<div class="paragraph"><p>If it is <code>before</code>, then each new trailer will appear just before the
879first trailer with the same &lt;token&gt;.</p></div>
880</dd>
881<dt class="hdlist1">
882trailer.ifexists
883</dt>
884<dd>
885<p>
886 This option makes it possible to choose what action will be
887 performed when there is already at least one trailer with the
888 same &lt;token&gt; in the message.
889</p>
890<div class="paragraph"><p>The valid values for this option are: <code>addIfDifferentNeighbor</code> (this
Junio C Hamano222ed822017-06-02 06:24:06891is the default), <code>addIfDifferent</code>, <code>add</code>, <code>replace</code> or <code>doNothing</code>.</p></div>
Junio C Hamano4c43d652014-10-20 21:14:29892<div class="paragraph"><p>With <code>addIfDifferentNeighbor</code>, a new trailer will be added only if no
893trailer with the same (&lt;token&gt;, &lt;value&gt;) pair is above or below the line
894where the new trailer will be added.</p></div>
895<div class="paragraph"><p>With <code>addIfDifferent</code>, a new trailer will be added only if no trailer
896with the same (&lt;token&gt;, &lt;value&gt;) pair is already in the message.</p></div>
897<div class="paragraph"><p>With <code>add</code>, a new trailer will be added, even if some trailers with
898the same (&lt;token&gt;, &lt;value&gt;) pair are already in the message.</p></div>
899<div class="paragraph"><p>With <code>replace</code>, an existing trailer with the same &lt;token&gt; will be
900deleted and the new trailer will be added. The deleted trailer will be
901the closest one (with the same &lt;token&gt;) to the place where the new one
902will be added.</p></div>
903<div class="paragraph"><p>With <code>doNothing</code>, nothing will be done; that is no new trailer will be
904added if there is already one with the same &lt;token&gt; in the message.</p></div>
905</dd>
906<dt class="hdlist1">
907trailer.ifmissing
908</dt>
909<dd>
910<p>
911 This option makes it possible to choose what action will be
912 performed when there is not yet any trailer with the same
913 &lt;token&gt; in the message.
914</p>
915<div class="paragraph"><p>The valid values for this option are: <code>add</code> (this is the default) and
916<code>doNothing</code>.</p></div>
917<div class="paragraph"><p>With <code>add</code>, a new trailer will be added.</p></div>
918<div class="paragraph"><p>With <code>doNothing</code>, nothing will be done.</p></div>
919</dd>
920<dt class="hdlist1">
921trailer.&lt;token&gt;.key
922</dt>
923<dd>
924<p>
925 This <code>key</code> will be used instead of &lt;token&gt; in the trailer. At
926 the end of this key, a separator can appear and then some
927 space characters. By default the only valid separator is <em>:</em>,
928 but this can be changed using the <code>trailer.separators</code> config
929 variable.
930</p>
931<div class="paragraph"><p>If there is a separator, then the key will be used instead of both the
932&lt;token&gt; and the default separator when adding the trailer.</p></div>
933</dd>
934<dt class="hdlist1">
935trailer.&lt;token&gt;.where
936</dt>
937<dd>
938<p>
939 This option takes the same values as the <em>trailer.where</em>
940 configuration variable and it overrides what is specified by
941 that option for trailers with the specified &lt;token&gt;.
942</p>
943</dd>
944<dt class="hdlist1">
945trailer.&lt;token&gt;.ifexist
946</dt>
947<dd>
948<p>
949 This option takes the same values as the <em>trailer.ifexist</em>
950 configuration variable and it overrides what is specified by
951 that option for trailers with the specified &lt;token&gt;.
952</p>
953</dd>
954<dt class="hdlist1">
955trailer.&lt;token&gt;.ifmissing
956</dt>
957<dd>
958<p>
959 This option takes the same values as the <em>trailer.ifmissing</em>
960 configuration variable and it overrides what is specified by
961 that option for trailers with the specified &lt;token&gt;.
962</p>
963</dd>
964<dt class="hdlist1">
965trailer.&lt;token&gt;.command
966</dt>
967<dd>
968<p>
969 This option can be used to specify a shell command that will
970 be called to automatically add or modify a trailer with the
971 specified &lt;token&gt;.
972</p>
973<div class="paragraph"><p>When this option is specified, the behavior is as if a special
974<em>&lt;token&gt;=&lt;value&gt;</em> argument were added at the beginning of the command
975line, where &lt;value&gt; is taken to be the standard output of the
976specified command with any leading and trailing whitespace trimmed
977off.</p></div>
978<div class="paragraph"><p>If the command contains the <code>$ARG</code> string, this string will be
979replaced with the &lt;value&gt; part of an existing trailer with the same
980&lt;token&gt;, if any, before the command is launched.</p></div>
981<div class="paragraph"><p>If some <em>&lt;token&gt;=&lt;value&gt;</em> arguments are also passed on the command
982line, when a <em>trailer.&lt;token&gt;.command</em> is configured, the command will
983also be executed for each of these arguments. And the &lt;value&gt; part of
984these arguments, if any, will be used to replace the <code>$ARG</code> string in
985the command.</p></div>
986</dd>
987</dl></div>
988</div>
989</div>
990<div class="sect1">
991<h2 id="_examples">EXAMPLES</h2>
992<div class="sectionbody">
993<div class="ulist"><ul>
994<li>
995<p>
996Configure a <em>sign</em> trailer with a <em>Signed-off-by</em> key, and then
997 add two of these trailers to a message:
998</p>
999<div class="listingblock">
1000<div class="content">
1001<pre><code>$ git config trailer.sign.key "Signed-off-by"
1002$ cat msg.txt
1003subject
1004
1005message
1006$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice &lt;alice@example.com&gt;' --trailer 'sign: Bob &lt;bob@example.com&gt;'
1007subject
1008
1009message
1010
1011Signed-off-by: Alice &lt;alice@example.com&gt;
1012Signed-off-by: Bob &lt;bob@example.com&gt;</code></pre>
1013</div></div>
1014</li>
1015<li>
1016<p>
Junio C Hamano92d80372016-07-13 22:00:051017Use the <code>--in-place</code> option to edit a message file in place:
Junio C Hamano7d098642016-01-30 00:05:211018</p>
1019<div class="listingblock">
1020<div class="content">
1021<pre><code>$ cat msg.txt
1022subject
1023
1024message
1025
1026Signed-off-by: Bob &lt;bob@example.com&gt;
1027$ git interpret-trailers --trailer 'Acked-by: Alice &lt;alice@example.com&gt;' --in-place msg.txt
1028$ cat msg.txt
1029subject
1030
1031message
1032
1033Signed-off-by: Bob &lt;bob@example.com&gt;
1034Acked-by: Alice &lt;alice@example.com&gt;</code></pre>
1035</div></div>
1036</li>
1037<li>
1038<p>
Junio C Hamano4c43d652014-10-20 21:14:291039Extract the last commit as a patch, and add a <em>Cc</em> and a
1040 <em>Reviewed-by</em> trailer to it:
1041</p>
1042<div class="listingblock">
1043<div class="content">
1044<pre><code>$ git format-patch -1
10450001-foo.patch
1046$ git interpret-trailers --trailer 'Cc: Alice &lt;alice@example.com&gt;' --trailer 'Reviewed-by: Bob &lt;bob@example.com&gt;' 0001-foo.patch &gt;0001-bar.patch</code></pre>
1047</div></div>
1048</li>
1049<li>
1050<p>
1051Configure a <em>sign</em> trailer with a command to automatically add a
1052 'Signed-off-by: ' with the author information only if there is no
1053 'Signed-off-by: ' already, and show how it works:
1054</p>
1055<div class="listingblock">
1056<div class="content">
1057<pre><code>$ git config trailer.sign.key "Signed-off-by: "
1058$ git config trailer.sign.ifmissing add
1059$ git config trailer.sign.ifexists doNothing
1060$ git config trailer.sign.command 'echo "$(git config user.name) &lt;$(git config user.email)&gt;"'
1061$ git interpret-trailers &lt;&lt;EOF
1062&gt; EOF
1063
1064Signed-off-by: Bob &lt;bob@example.com&gt;
1065$ git interpret-trailers &lt;&lt;EOF
1066&gt; Signed-off-by: Alice &lt;alice@example.com&gt;
1067&gt; EOF
1068
1069Signed-off-by: Alice &lt;alice@example.com&gt;</code></pre>
1070</div></div>
1071</li>
1072<li>
1073<p>
1074Configure a <em>fix</em> trailer with a key that contains a <em>#</em> and no
1075 space after this character, and show how it works:
1076</p>
1077<div class="listingblock">
1078<div class="content">
1079<pre><code>$ git config trailer.separators ":#"
1080$ git config trailer.fix.key "Fix #"
1081$ echo "subject" | git interpret-trailers --trailer fix=42
1082subject
1083
1084Fix #42</code></pre>
1085</div></div>
1086</li>
1087<li>
1088<p>
1089Configure a <em>see</em> trailer with a command to show the subject of a
1090 commit that is related, and show how it works:
1091</p>
1092<div class="listingblock">
1093<div class="content">
1094<pre><code>$ git config trailer.see.key "See-also: "
1095$ git config trailer.see.ifExists "replace"
1096$ git config trailer.see.ifMissing "doNothing"
1097$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
1098$ git interpret-trailers &lt;&lt;EOF
1099&gt; subject
1100&gt;
1101&gt; message
1102&gt;
1103&gt; see: HEAD~2
1104&gt; EOF
1105subject
1106
1107message
1108
1109See-also: fe3187489d69c4 (subject of related commit)</code></pre>
1110</div></div>
1111</li>
1112<li>
1113<p>
1114Configure a commit template with some trailers with empty values
1115 (using sed to show and keep the trailing spaces at the end of the
1116 trailers), then configure a commit-msg hook that uses
1117 <em>git interpret-trailers</em> to remove trailers with empty values and
1118 to add a <em>git-version</em> trailer:
1119</p>
1120<div class="listingblock">
1121<div class="content">
1122<pre><code>$ sed -e 's/ Z$/ /' &gt;commit_template.txt &lt;&lt;EOF
1123&gt; ***subject***
1124&gt;
1125&gt; ***message***
1126&gt;
1127&gt; Fixes: Z
1128&gt; Cc: Z
1129&gt; Reviewed-by: Z
1130&gt; Signed-off-by: Z
1131&gt; EOF
1132$ git config commit.template commit_template.txt
1133$ cat &gt;.git/hooks/commit-msg &lt;&lt;EOF
1134&gt; #!/bin/sh
1135&gt; git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" &gt; "\$1.new"
1136&gt; mv "\$1.new" "\$1"
1137&gt; EOF
1138$ chmod +x .git/hooks/commit-msg</code></pre>
1139</div></div>
1140</li>
1141</ul></div>
1142</div>
1143</div>
1144<div class="sect1">
1145<h2 id="_see_also">SEE ALSO</h2>
1146<div class="sectionbody">
1147<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>
1148</div>
1149</div>
1150<div class="sect1">
1151<h2 id="_git">GIT</h2>
1152<div class="sectionbody">
1153<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1154</div>
1155</div>
1156</div>
1157<div id="footnotes"><hr /></div>
1158<div id="footer">
1159<div id="footer-text">
Junio C Hamano222ed822017-06-02 06:24:061160Last updated 2017-06-02 15:23:19 JST
Junio C Hamano4c43d652014-10-20 21:14:291161</div>
1162</div>
1163</body>
1164</html>