Autogenerated HTML docs for v2.45.2-404-g9eaef
[git-htmldocs.git] / SubmittingPatches.html
blobd20b6c726fa9f7ba832ba54b5055c5a2e45db27c
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">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>Submitting Patches</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.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 {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
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; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
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 {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
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; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
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;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
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 {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: 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;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
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
552 * Version: 0.4
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 */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
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
586 // browsers).
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);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
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");
631 div.appendChild(a);
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.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
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");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!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];
678 spans[i].innerHTML =
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;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
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.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="article">
736 <div id="header">
737 <h1>Submitting Patches</h1>
738 <span id="revdate">2024-05-31</span>
739 </div>
740 <div id="content">
741 <div class="sect1">
742 <h2 id="_guidelines">Guidelines</h2>
743 <div class="sectionbody">
744 <div class="paragraph"><p>Here are some guidelines for contributing back to this
745 project. There is also a <a href="MyFirstContribution.html">step-by-step tutorial</a>
746 available which covers many of these same guidelines.</p></div>
747 <div class="sect2">
748 <h3 id="patch-flow">A typical life cycle of a patch series</h3>
749 <div class="paragraph"><p>To help us understand the reason behind various guidelines given later
750 in the document, first let&#8217;s understand how the life cycle of a
751 typical patch series for this project goes.</p></div>
752 <div class="olist arabic"><ol class="arabic">
753 <li>
755 You come up with an itch. You code it up. You do not need any
756 pre-authorization from the project to do so.
757 </p>
758 <div class="paragraph"><p>Your patches will be reviewed by other contributors on the mailing
759 list, and the reviews will be done to assess the merit of various
760 things, like the general idea behind your patch (including "is it
761 solving a problem worth solving in the first place?"), the reason
762 behind the design of the solution, and the actual implementation.
763 The guidelines given here are there to help your patches by making
764 them easier to understand by the reviewers.</p></div>
765 </li>
766 <li>
768 You send the patches to the list and cc people who may need to know
769 about the change. Your goal is <strong>not</strong> necessarily to convince others
770 that what you are building is good. Your goal is to get help in
771 coming up with a solution for the "itch" that is better than what
772 you can build alone.
773 </p>
774 <div class="paragraph"><p>The people who may need to know are the ones who worked on the code
775 you are touching. These people happen to be the ones who are
776 most likely to be knowledgeable enough to help you, but
777 they have no obligation to help you (i.e. you ask them for help,
778 you don&#8217;t demand). <code>git log -p &#45;&#45; <em>$area_you_are_modifying</em></code> would
779 help you find out who they are.</p></div>
780 </li>
781 <li>
783 You get comments and suggestions for improvements. You may even get
784 them in an "on top of your change" patch form. You are expected to
785 respond to them with "Reply-All" on the mailing list, while taking
786 them into account while preparing an updated set of patches.
787 </p>
788 </li>
789 <li>
791 Polish, refine, and re-send your patches to the list and to the people
792 who spent their time to improve your patch. Go back to step (2).
793 </p>
794 </li>
795 <li>
797 While the above iterations improve your patches, the maintainer may
798 pick the patches up from the list and queue them to the <code>seen</code>
799 branch, in order to make it easier for people to play with it
800 without having to pick up and apply the patches to their trees
801 themselves. Being in <code>seen</code> has no other meaning. Specifically, it
802 does not mean the patch was "accepted" in any way.
803 </p>
804 </li>
805 <li>
807 When the discussion reaches a consensus that the latest iteration of
808 the patches are in good enough shape, the maintainer includes the
809 topic in the "What&#8217;s cooking" report that are sent out a few times a
810 week to the mailing list, marked as "Will merge to <em>next</em>." This
811 decision is primarily made by the maintainer with help from those
812 who participated in the review discussion.
813 </p>
814 </li>
815 <li>
817 After the patches are merged to the <em>next</em> branch, the discussion
818 can still continue to further improve them by adding more patches on
819 top, but by the time a topic gets merged to <em>next</em>, it is expected
820 that everybody agrees that the scope and the basic direction of the
821 topic are appropriate, so such an incremental updates are limited to
822 small corrections and polishing. After a topic cooks for some time
823 (like 7 calendar days) in <em>next</em> without needing further tweaks on
824 top, it gets merged to the <em>master</em> branch and wait to become part
825 of the next major release.
826 </p>
827 </li>
828 </ol></div>
829 <div class="paragraph"><p>In the following sections, many techniques and conventions are listed
830 to help your patches get reviewed effectively in such a life cycle.</p></div>
831 </div>
832 <div class="sect2">
833 <h3 id="choose-starting-point">Choose a starting point.</h3>
834 <div class="paragraph"><p>As a preliminary step, you must first choose a starting point for your
835 work. Typically this means choosing a branch, although technically
836 speaking it is actually a particular commit (typically the HEAD, or tip,
837 of the branch).</p></div>
838 <div class="paragraph"><p>There are several important branches to be aware of. Namely, there are
839 four integration branches as discussed in <a href="gitworkflows.html">gitworkflows(7)</a>:</p></div>
840 <div class="ulist"><ul>
841 <li>
843 maint
844 </p>
845 </li>
846 <li>
848 master
849 </p>
850 </li>
851 <li>
853 next
854 </p>
855 </li>
856 <li>
858 seen
859 </p>
860 </li>
861 </ul></div>
862 <div class="paragraph"><p>The branches lower on the list are typically descendants of the ones
863 that come before it. For example, <code>maint</code> is an "older" branch than
864 <code>master</code> because <code>master</code> usually has patches (commits) on top of
865 <code>maint</code>.</p></div>
866 <div class="paragraph"><p>There are also "topic" branches, which contain work from other
867 contributors. Topic branches are created by the Git maintainer (in
868 their fork) to organize the current set of incoming contributions on
869 the mailing list, and are itemized in the regular "What&#8217;s cooking in
870 git.git" announcements. To find the tip of a topic branch, run <code>git log
871 --first-parent master..seen</code> and look for the merge commit. The second
872 parent of this commit is the tip of the topic branch.</p></div>
873 <div class="paragraph"><p>There is one guiding principle for choosing the right starting point: in
874 general, always base your work on the oldest integration branch that
875 your change is relevant to (see "Merge upwards" in
876 <a href="gitworkflows.html">gitworkflows(7)</a>). What this principle means is that for the
877 vast majority of cases, the starting point for new work should be the
878 latest HEAD commit of <code>maint</code> or <code>master</code> based on the following cases:</p></div>
879 <div class="ulist"><ul>
880 <li>
882 If you are fixing bugs in the released version, use <code>maint</code> as the
883 starting point (which may mean you have to fix things without using
884 new API features on the cutting edge that recently appeared in
885 <code>master</code> but were not available in the released version).
886 </p>
887 </li>
888 <li>
890 Otherwise (such as if you are adding new features) use <code>master</code>.
891 </p>
892 </li>
893 </ul></div>
894 <div class="admonitionblock">
895 <table><tr>
896 <td class="icon">
897 <div class="title">Note</div>
898 </td>
899 <td class="content">In exceptional cases, a bug that was introduced in an old
900 version may have to be fixed for users of releases that are much older
901 than the recent releases. <code>git describe --contains X</code> may describe
902 <code>X</code> as <code>v2.30.0-rc2-gXXXXXX</code> for the commit <code>X</code> that introduced the
903 bug, and the bug may be so high-impact that we may need to issue a new
904 maintenance release for Git 2.30.x series, when "Git 2.41.0" is the
905 current release. In such a case, you may want to use the tip of the
906 maintenance branch for the 2.30.x series, which may be available in the
907 <code>maint-2.30</code> branch in <a href="https://github.com/gitster/git">the maintainer&#8217;s
908 "broken out" repo</a>.</td>
909 </tr></table>
910 </div>
911 <div class="paragraph"><p>This also means that <code>next</code> or <code>seen</code> are inappropriate starting points
912 for your work, if you want your work to have a realistic chance of
913 graduating to <code>master</code>. They are simply not designed to be used as a
914 base for new work; they are only there to make sure that topics in
915 flight work well together. This is why both <code>next</code> and <code>seen</code> are
916 frequently re-integrated with incoming patches on the mailing list and
917 force-pushed to replace previous versions of themselves. A topic that is
918 literally built on top of <code>next</code> cannot be merged to <code>master</code> without
919 dragging in all the other topics in <code>next</code>, some of which may not be
920 ready.</p></div>
921 <div class="paragraph"><p>For example, if you are making tree-wide changes, while somebody else is
922 also making their own tree-wide changes, your work may have severe
923 overlap with the other person&#8217;s work. This situation may tempt you to
924 use <code>next</code> as your starting point (because it would have the other
925 person&#8217;s work included in it), but doing so would mean you&#8217;ll not only
926 depend on the other person&#8217;s work, but all the other random things from
927 other contributors that are already integrated into <code>next</code>. And as soon
928 as <code>next</code> is updated with a new version, all of your work will need to
929 be rebased anyway in order for them to be cleanly applied by the
930 maintainer.</p></div>
931 <div class="paragraph"><p>Under truly exceptional circumstances where you absolutely must depend
932 on a select few topic branches that are already in <code>next</code> but not in
933 <code>master</code>, you may want to create your own custom base-branch by forking
934 <code>master</code> and merging the required topic branches into it. You could then
935 work on top of this base-branch. But keep in mind that this base-branch
936 would only be known privately to you. So when you are ready to send
937 your patches to the list, be sure to communicate how you created it in
938 your cover letter. This critical piece of information would allow
939 others to recreate your base-branch on their end in order for them to
940 try out your work.</p></div>
941 <div class="paragraph"><p>Finally, note that some parts of the system have dedicated maintainers
942 with their own separate source code repositories (see the section
943 "Subsystems" below).</p></div>
944 </div>
945 <div class="sect2">
946 <h3 id="separate-commits">Make separate commits for logically separate changes.</h3>
947 <div class="paragraph"><p>Unless your patch is really trivial, you should not be sending
948 out a patch that was generated between your working tree and
949 your commit head. Instead, always make a commit with complete
950 commit message and generate a series of patches from your
951 repository. It is a good discipline.</p></div>
952 <div class="paragraph"><p>Give an explanation for the change(s) that is detailed enough so
953 that people can judge if it is good thing to do, without reading
954 the actual patch text to determine how well the code does what
955 the explanation promises to do.</p></div>
956 <div class="paragraph"><p>If your description starts to get too long, that&#8217;s a sign that you
957 probably need to split up your commit to finer grained pieces.
958 That being said, patches which plainly describe the things that
959 help reviewers check the patch, and future maintainers understand
960 the code, are the most beautiful patches. Descriptions that summarize
961 the point in the subject well, and describe the motivation for the
962 change, the approach taken by the change, and if relevant how this
963 differs substantially from the prior version, are all good things
964 to have.</p></div>
965 <div class="paragraph"><p>Make sure that you have tests for the bug you are fixing. See
966 <code>t/README</code> for guidance.</p></div>
967 <div class="paragraph" id="tests"><p>When adding a new feature, make sure that you have new tests to show
968 the feature triggers the new behavior when it should, and to show the
969 feature does not trigger when it shouldn&#8217;t. After any code change,
970 make sure that the entire test suite passes. When fixing a bug, make
971 sure you have new tests that break if somebody else breaks what you
972 fixed by accident to avoid regression. Also, try merging your work to
973 <em>next</em> and <em>seen</em> and make sure the tests still pass; topics by others
974 that are still in flight may have unexpected interactions with what
975 you are trying to do in your topic.</p></div>
976 <div class="paragraph"><p>Pushing to a fork of <a href="https://github.com/git/git">https://github.com/git/git</a> will use their CI
977 integration to test your changes on Linux, Mac and Windows. See the
978 <a href="#GHCI">GitHub CI</a> section for details.</p></div>
979 <div class="paragraph"><p>Do not forget to update the documentation to describe the updated
980 behavior and make sure that the resulting documentation set formats
981 well (try the Documentation/doc-diff script).</p></div>
982 <div class="paragraph"><p>We currently have a liberal mixture of US and UK English norms for
983 spelling and grammar, which is somewhat unfortunate. A huge patch that
984 touches the files all over the place only to correct the inconsistency
985 is not welcome, though. Potential clashes with other changes that can
986 result from such a patch are not worth it. We prefer to gradually
987 reconcile the inconsistencies in favor of US English, with small and
988 easily digestible patches, as a side effect of doing some other real
989 work in the vicinity (e.g. rewriting a paragraph for clarity, while
990 turning en_UK spelling to en_US). Obvious typographical fixes are much
991 more welcomed ("teh &#8594; "the"), preferably submitted as independent
992 patches separate from other documentation changes.</p></div>
993 <div class="paragraph" id="whitespace-check"><p>Oh, another thing. We are picky about whitespaces. Make sure your
994 changes do not trigger errors with the sample pre-commit hook shipped
995 in <code>templates/hooks--pre-commit</code>. To help ensure this does not happen,
996 run <code>git diff --check</code> on your changes before you commit.</p></div>
997 </div>
998 <div class="sect2">
999 <h3 id="describe-changes">Describe your changes well.</h3>
1000 <div class="paragraph"><p>The log message that explains your changes is just as important as the
1001 changes themselves. Your code may be clearly written with in-code
1002 comment to sufficiently explain how it works with the surrounding
1003 code, but those who need to fix or enhance your code in the future
1004 will need to know <em>why</em> your code does what it does, for a few
1005 reasons:</p></div>
1006 <div class="olist arabic"><ol class="arabic">
1007 <li>
1009 Your code may be doing something differently from what you wanted it
1010 to do. Writing down what you actually wanted to achieve will help
1011 them fix your code and make it do what it should have been doing
1012 (also, you often discover your own bugs yourself, while writing the
1013 log message to summarize the thought behind it).
1014 </p>
1015 </li>
1016 <li>
1018 Your code may be doing things that were only necessary for your
1019 immediate needs (e.g. "do X to directories" without implementing or
1020 even designing what is to be done on files). Writing down why you
1021 excluded what the code does not do will help guide future developers.
1022 Writing down "we do X to directories, because directories have
1023 characteristic Y" would help them infer "oh, files also have the same
1024 characteristic Y, so perhaps doing X to them would also make sense?".
1025 Saying "we don&#8217;t do the same X to files, because &#8230;" will help them
1026 decide if the reasoning is sound (in which case they do not waste
1027 time extending your code to cover files), or reason differently (in
1028 which case, they can explain why they extend your code to cover
1029 files, too).
1030 </p>
1031 </li>
1032 </ol></div>
1033 <div class="paragraph"><p>The goal of your log message is to convey the <em>why</em> behind your change
1034 to help future developers. The reviewers will also make sure that
1035 your proposed log message will serve this purpose well.</p></div>
1036 <div class="paragraph"><p>The first line of the commit message should be a short description (50
1037 characters is the soft limit, see DISCUSSION in <a href="git-commit.html">git-commit(1)</a>),
1038 and should skip the full stop. It is also conventional in most cases to
1039 prefix the first line with "area: " where the area is a filename or
1040 identifier for the general area of the code being modified, e.g.</p></div>
1041 <div class="ulist"><ul>
1042 <li>
1044 doc: clarify distinction between sign-off and pgp-signing
1045 </p>
1046 </li>
1047 <li>
1049 githooks.txt: improve the intro section
1050 </p>
1051 </li>
1052 </ul></div>
1053 <div class="paragraph"><p>If in doubt which identifier to use, run <code>git log --no-merges</code> on the
1054 files you are modifying to see the current conventions.</p></div>
1055 <div class="paragraph" id="summary-section"><p>The title sentence after the "area:" prefix omits the full stop at the
1056 end, and its first word is not capitalized (the omission
1057 of capitalization applies only to the word after the "area:"
1058 prefix of the title) unless there is a reason to
1059 capitalize it other than because it is the first word in the sentence.
1060 E.g. "doc: clarify&#8230;", not "doc: Clarify&#8230;", or "githooks.txt:
1061 improve&#8230;", not "githooks.txt: Improve&#8230;". But "refs: HEAD is also
1062 treated as a ref" is correct, as we spell <code>HEAD</code> in all caps even when
1063 it appears in the middle of a sentence.</p></div>
1064 <div class="paragraph" id="meaningful-message"><p>The body should provide a meaningful commit message, which:</p></div>
1065 <div class="olist arabic"><ol class="arabic">
1066 <li>
1068 explains the problem the change tries to solve, i.e. what is wrong
1069 with the current code without the change.
1070 </p>
1071 </li>
1072 <li>
1074 justifies the way the change solves the problem, i.e. why the
1075 result with the change is better.
1076 </p>
1077 </li>
1078 <li>
1080 alternate solutions considered but discarded, if any.
1081 </p>
1082 </li>
1083 </ol></div>
1084 <div class="paragraph" id="present-tense"><p>The problem statement that describes the status quo is written in the
1085 present tense. Write "The code does X when it is given input Y",
1086 instead of "The code used to do Y when given input X". You do not
1087 have to say "Currently"---the status quo in the problem statement is
1088 about the code <em>without</em> your change, by project convention.</p></div>
1089 <div class="paragraph" id="imperative-mood"><p>Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
1090 instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
1091 to do frotz", as if you are giving orders to the codebase to change
1092 its behavior. Try to make sure your explanation can be understood
1093 without external resources. Instead of giving a URL to a mailing list
1094 archive, summarize the relevant points of the discussion.</p></div>
1095 <div class="paragraph" id="commit-reference"><p>There are a few reasons why you may want to refer to another commit in
1096 the "more stable" part of the history (i.e. on branches like <code>maint</code>,
1097 <code>master</code>, and <code>next</code>):</p></div>
1098 <div class="olist arabic"><ol class="arabic">
1099 <li>
1101 A commit that introduced the root cause of a bug you are fixing.
1102 </p>
1103 </li>
1104 <li>
1106 A commit that introduced a feature that you are enhancing.
1107 </p>
1108 </li>
1109 <li>
1111 A commit that conflicts with your work when you made a trial merge
1112 of your work into <code>next</code> and <code>seen</code> for testing.
1113 </p>
1114 </li>
1115 </ol></div>
1116 <div class="paragraph"><p>When you reference a commit on a more stable branch (like <code>master</code>,
1117 <code>maint</code> and <code>next</code>), use the format "abbreviated hash (subject,
1118 date)", like this:</p></div>
1119 <div class="literalblock">
1120 <div class="content">
1121 <pre><code> Commit f86a374 (pack-bitmap.c: fix a memleak, 2015-03-30)
1122 noticed that ...</code></pre>
1123 </div></div>
1124 <div class="paragraph"><p>The "Copy commit reference" command of gitk can be used to obtain this
1125 format (with the subject enclosed in a pair of double-quotes), or this
1126 invocation of <code>git show</code>:</p></div>
1127 <div class="literalblock">
1128 <div class="content">
1129 <pre><code> git show -s --pretty=reference &lt;commit&gt;</code></pre>
1130 </div></div>
1131 <div class="paragraph"><p>or, on an older version of Git without support for --pretty=reference:</p></div>
1132 <div class="literalblock">
1133 <div class="content">
1134 <pre><code> git show -s --date=short --pretty='format:%h (%s, %ad)' &lt;commit&gt;</code></pre>
1135 </div></div>
1136 </div>
1137 <div class="sect2">
1138 <h3 id="sign-off">Certify your work by adding your <code>Signed-off-by</code> trailer</h3>
1139 <div class="paragraph"><p>To improve tracking of who did what, we ask you to certify that you
1140 wrote the patch or have the right to pass it on under the same license
1141 as ours, by "signing off" your patch. Without sign-off, we cannot
1142 accept your patches.</p></div>
1143 <div class="paragraph"><p>If (and only if) you certify the below D-C-O:</p></div>
1144 <div class="quoteblock" id="dco">
1145 <div class="title">Developer&#8217;s Certificate of Origin 1.1</div>
1146 <div class="content">
1147 <div class="paragraph"><p>By making a contribution to this project, I certify that:</p></div>
1148 <div class="olist loweralpha"><ol class="loweralpha">
1149 <li>
1151 The contribution was created in whole or in part by me and I
1152 have the right to submit it under the open source license
1153 indicated in the file; or
1154 </p>
1155 </li>
1156 <li>
1158 The contribution is based upon previous work that, to the best
1159 of my knowledge, is covered under an appropriate open source
1160 license and I have the right under that license to submit that
1161 work with modifications, whether created in whole or in part
1162 by me, under the same open source license (unless I am
1163 permitted to submit under a different license), as indicated
1164 in the file; or
1165 </p>
1166 </li>
1167 <li>
1169 The contribution was provided directly to me by some other
1170 person who certified (a), (b) or (c) and I have not modified
1172 </p>
1173 </li>
1174 <li>
1176 I understand and agree that this project and the contribution
1177 are public and that a record of the contribution (including all
1178 personal information I submit with it, including my sign-off) is
1179 maintained indefinitely and may be redistributed consistent with
1180 this project or the open source license(s) involved.
1181 </p>
1182 </li>
1183 </ol></div>
1184 </div>
1185 <div class="attribution">
1186 </div></div>
1187 <div class="paragraph"><p>you add a "Signed-off-by" trailer to your commit, that looks like
1188 this:</p></div>
1189 <div class="literalblock">
1190 <div class="content">
1191 <pre><code> Signed-off-by: Random J Developer &lt;random@developer.example.org&gt;</code></pre>
1192 </div></div>
1193 <div class="paragraph"><p>This line can be added by Git if you run the git-commit command with
1194 the -s option.</p></div>
1195 <div class="paragraph"><p>Notice that you can place your own <code>Signed-off-by</code> trailer when
1196 forwarding somebody else&#8217;s patch with the above rules for
1197 D-C-O. Indeed you are encouraged to do so. Do not forget to
1198 place an in-body "From: " line at the beginning to properly attribute
1199 the change to its true author (see (2) above).</p></div>
1200 <div class="paragraph"><p>This procedure originally came from the Linux kernel project, so our
1201 rule is quite similar to theirs, but what exactly it means to sign-off
1202 your patch differs from project to project, so it may be different
1203 from that of the project you are accustomed to.</p></div>
1204 <div class="paragraph" id="real-name"><p>Also notice that a real name is used in the <code>Signed-off-by</code> trailer. Please
1205 don&#8217;t hide your real name.</p></div>
1206 <div class="paragraph" id="commit-trailers"><p>If you like, you can put extra tags at the end:</p></div>
1207 <div class="olist arabic"><ol class="arabic">
1208 <li>
1210 <code>Reported-by:</code> is used to credit someone who found the bug that
1211 the patch attempts to fix.
1212 </p>
1213 </li>
1214 <li>
1216 <code>Acked-by:</code> says that the person who is more familiar with the area
1217 the patch attempts to modify liked the patch.
1218 </p>
1219 </li>
1220 <li>
1222 <code>Reviewed-by:</code>, unlike the other tags, can only be offered by the
1223 reviewers themselves when they are completely satisfied with the
1224 patch after a detailed analysis.
1225 </p>
1226 </li>
1227 <li>
1229 <code>Tested-by:</code> is used to indicate that the person applied the patch
1230 and found it to have the desired effect.
1231 </p>
1232 </li>
1233 <li>
1235 <code>Co-authored-by:</code> is used to indicate that people exchanged drafts
1236 of a patch before submitting it.
1237 </p>
1238 </li>
1239 <li>
1241 <code>Helped-by:</code> is used to credit someone who suggested ideas for
1242 changes without providing the precise changes in patch form.
1243 </p>
1244 </li>
1245 <li>
1247 <code>Mentored-by:</code> is used to credit someone with helping develop a
1248 patch as part of a mentorship program (e.g., GSoC or Outreachy).
1249 </p>
1250 </li>
1251 <li>
1253 <code>Suggested-by:</code> is used to credit someone with suggesting the idea
1254 for a patch.
1255 </p>
1256 </li>
1257 </ol></div>
1258 <div class="paragraph"><p>While you can also create your own trailer if the situation warrants it, we
1259 encourage you to instead use one of the common trailers in this project
1260 highlighted above.</p></div>
1261 <div class="paragraph"><p>Only capitalize the very first letter of tags, i.e. favor
1262 "Signed-off-by" over "Signed-Off-By" and "Acked-by:" over "Acked-By".</p></div>
1263 </div>
1264 <div class="sect2">
1265 <h3 id="git-tools">Generate your patch using Git tools out of your commits.</h3>
1266 <div class="paragraph"><p>Git based diff tools generate unidiff which is the preferred format.</p></div>
1267 <div class="paragraph"><p>You do not have to be afraid to use <code>-M</code> option to <code>git diff</code> or
1268 <code>git format-patch</code>, if your patch involves file renames. The
1269 receiving end can handle them just fine.</p></div>
1270 <div class="paragraph" id="review-patch"><p>Please make sure your patch does not add commented out debugging code,
1271 or include any extra files which do not relate to what your patch
1272 is trying to achieve. Make sure to review
1273 your patch after generating it, to ensure accuracy. Before
1274 sending out, please make sure it cleanly applies to the starting point you
1275 have chosen in the "Choose a starting point" section.</p></div>
1276 <div class="admonitionblock">
1277 <table><tr>
1278 <td class="icon">
1279 <div class="title">Note</div>
1280 </td>
1281 <td class="content">From the perspective of those reviewing your patch, the <code>master</code>
1282 branch is the default expected starting point. So if you have chosen a
1283 different starting point, please communicate this choice in your cover
1284 letter.</td>
1285 </tr></table>
1286 </div>
1287 </div>
1288 <div class="sect2">
1289 <h3 id="send-patches">Sending your patches.</h3>
1290 <div class="sect3">
1291 <h4 id="_choosing_your_reviewers">Choosing your reviewers</h4>
1292 <div class="admonitionblock">
1293 <table><tr>
1294 <td class="icon">
1295 <div class="title">Note</div>
1296 </td>
1297 <td class="content">Patches that may be
1298 security relevant should be submitted privately to the Git Security
1299 mailing list<span class="footnote" id="_footnote_security-ml"><br />[The Git Security mailing list: <a href="mailto:git-security@googlegroups.com">git-security@googlegroups.com</a>]<br /></span>, instead of the public mailing list.</td>
1300 </tr></table>
1301 </div>
1302 <div class="paragraph"><p>Send your patch with "To:" set to the mailing list, with "cc:" listing
1303 people who are involved in the area you are touching (the <code>git-contacts</code>
1304 script in <code>contrib/contacts/</code><span class="footnote" id="_footnote_contrib-scripts"><br />[Scripts under <code>contrib/</code> are not part of the core <code>git</code> binary and must be called directly. Clone the Git codebase and run <code>perl contrib/contacts/git-contacts</code>.]<br /></span> can help to
1305 identify them), to solicit comments and reviews. Also, when you made
1306 trial merges of your topic to <code>next</code> and <code>seen</code>, you may have noticed
1307 work by others conflicting with your changes. There is a good possibility
1308 that these people may know the area you are touching well.</p></div>
1309 <div class="paragraph"><p>If you are using <code>send-email</code>, you can feed it the output of <code>git-contacts</code> like
1310 this:</p></div>
1311 <div class="literalblock">
1312 <div class="content">
1313 <pre><code> git send-email --cc-cmd='perl contrib/contacts/git-contacts' feature/*.patch</code></pre>
1314 </div></div>
1315 <div class="paragraph"><p>After the list reached a consensus that it is a good idea to apply the
1316 patch, re-send it with "To:" set to the maintainer<span class="footnote"><br />[The current maintainer: <a href="mailto:gitster@pobox.com">gitster@pobox.com</a>]<br /></span>
1317 and "cc:" the list<span class="footnote"><br />[The mailing list: <a href="mailto:git@vger.kernel.org">git@vger.kernel.org</a>]<br /></span> for inclusion. This is especially relevant
1318 when the maintainer did not heavily participate in the discussion and
1319 instead left the review to trusted others.</p></div>
1320 <div class="paragraph"><p>Do not forget to add trailers such as <code>Acked-by:</code>, <code>Reviewed-by:</code> and
1321 <code>Tested-by:</code> lines as necessary to credit people who helped your
1322 patch, and "cc:" them when sending such a final version for inclusion.</p></div>
1323 </div>
1324 <div class="sect3">
1325 <h4 id="_code_format_patch_code_and_code_send_email_code"><code>format-patch</code> and <code>send-email</code></h4>
1326 <div class="paragraph"><p>Learn to use <code>format-patch</code> and <code>send-email</code> if possible. These commands
1327 are optimized for the workflow of sending patches, avoiding many ways
1328 your existing e-mail client (often optimized for "multipart/*" MIME
1329 type e-mails) might render your patches unusable.</p></div>
1330 <div class="admonitionblock">
1331 <table><tr>
1332 <td class="icon">
1333 <div class="title">Note</div>
1334 </td>
1335 <td class="content">Here we outline the procedure using <code>format-patch</code> and
1336 <code>send-email</code>, but you can instead use GitGitGadget to send in your
1337 patches (see <a href="MyFirstContribution.html">MyFirstContribution</a>).</td>
1338 </tr></table>
1339 </div>
1340 <div class="paragraph"><p>People on the Git mailing list need to be able to read and
1341 comment on the changes you are submitting. It is important for
1342 a developer to be able to "quote" your changes, using standard
1343 e-mail tools, so that they may comment on specific portions of
1344 your code. For this reason, each patch should be submitted
1345 "inline" in a separate message.</p></div>
1346 <div class="paragraph"><p>All subsequent versions of a patch series and other related patches should be
1347 grouped into their own e-mail thread to help readers find all parts of the
1348 series. To that end, send them as replies to either an additional "cover
1349 letter" message (see below), the first patch, or the respective preceding patch.
1350 Here is a <a href="MyFirstContribution.html#v2-git-send-email">step-by-step guide</a> on
1351 how to submit updated versions of a patch series.</p></div>
1352 <div class="paragraph"><p>If your log message (including your name on the
1353 <code>Signed-off-by</code> trailer) is not writable in ASCII, make sure that
1354 you send off a message in the correct encoding.</p></div>
1355 <div class="admonitionblock">
1356 <table><tr>
1357 <td class="icon">
1358 <div class="title">Warning</div>
1359 </td>
1360 <td class="content">Be wary of your MUAs word-wrap
1361 corrupting your patch. Do not cut-n-paste your patch; you can
1362 lose tabs that way if you are not careful.</td>
1363 </tr></table>
1364 </div>
1365 <div class="paragraph"><p>It is a common convention to prefix your subject line with
1366 [PATCH]. This lets people easily distinguish patches from other
1367 e-mail discussions. Use of markers in addition to PATCH within
1368 the brackets to describe the nature of the patch is also
1369 encouraged. E.g. [RFC PATCH] (where RFC stands for "request for
1370 comments") is often used to indicate a patch needs further
1371 discussion before being accepted, [PATCH v2], [PATCH v3] etc.
1372 are often seen when you are sending an update to what you have
1373 previously sent.</p></div>
1374 <div class="paragraph"><p>The <code>git format-patch</code> command follows the best current practice to
1375 format the body of an e-mail message. At the beginning of the
1376 patch should come your commit message, ending with the
1377 <code>Signed-off-by</code> trailers, and a line that consists of three dashes,
1378 followed by the diffstat information and the patch itself. If
1379 you are forwarding a patch from somebody else, optionally, at
1380 the beginning of the e-mail message just before the commit
1381 message starts, you can put a "From: " line to name that person.
1382 To change the default "[PATCH]" in the subject to "[&lt;text&gt;]", use
1383 <code>git format-patch --subject-prefix=&lt;text&gt;</code>. As a shortcut, you
1384 can use <code>--rfc</code> instead of <code>--subject-prefix="RFC PATCH"</code>, or
1385 <code>-v &lt;n&gt;</code> instead of <code>--subject-prefix="PATCH v&lt;n&gt;"</code>.</p></div>
1386 <div class="paragraph"><p>You often want to add additional explanation about the patch,
1387 other than the commit message itself. Place such "cover letter"
1388 material between the three-dash line and the diffstat. For
1389 patches requiring multiple iterations of review and discussion,
1390 an explanation of changes between each iteration can be kept in
1391 Git-notes and inserted automatically following the three-dash
1392 line via <code>git format-patch --notes</code>.</p></div>
1393 <div class="paragraph" id="the-topic-summary"><p><strong>This is EXPERIMENTAL</strong>.</p></div>
1394 <div class="paragraph"><p>When sending a topic, you can propose a one-paragraph summary that
1395 should appear in the "What&#8217;s cooking" report when it is picked up to
1396 explain the topic. If you choose to do so, please write a 2-5 line
1397 paragraph that will fit well in our release notes (see many bulleted
1398 entries in the Documentation/RelNotes/* files for examples), and make
1399 it the first paragraph of the cover letter. For a single-patch
1400 series, use the space between the three-dash line and the diffstat, as
1401 described earlier.</p></div>
1402 <div class="paragraph" id="attachment"><p>Do not attach the patch as a MIME attachment, compressed or not.
1403 Do not let your e-mail client send quoted-printable. Do not let
1404 your e-mail client send format=flowed which would destroy
1405 whitespaces in your patches. Many
1406 popular e-mail applications will not always transmit a MIME
1407 attachment as plain text, making it impossible to comment on
1408 your code. A MIME attachment also takes a bit more time to
1409 process. This does not decrease the likelihood of your
1410 MIME-attached change being accepted, but it makes it more likely
1411 that it will be postponed.</p></div>
1412 <div class="paragraph"><p>Exception: If your mailer is mangling patches then someone may ask
1413 you to re-send them using MIME, that is OK.</p></div>
1414 <div class="paragraph" id="pgp-signature"><p>Do not PGP sign your patch. Most likely, your maintainer or other people on the
1415 list would not have your PGP key and would not bother obtaining it anyway.
1416 Your patch is not judged by who you are; a good patch from an unknown origin
1417 has a far better chance of being accepted than a patch from a known, respected
1418 origin that is done poorly or does incorrect things.</p></div>
1419 <div class="paragraph"><p>If you really really really really want to do a PGP signed
1420 patch, format it as "multipart/signed", not a text/plain message
1421 that starts with <code>-----BEGIN PGP SIGNED MESSAGE-----</code>. That is
1422 not a text/plain, it&#8217;s something else.</p></div>
1423 </div>
1424 </div>
1425 <div class="sect2">
1426 <h3 id="_handling_conflicts_and_iterating_patches">Handling Conflicts and Iterating Patches</h3>
1427 <div class="paragraph"><p>When revising changes made to your patches, it&#8217;s important to
1428 acknowledge the possibility of conflicts with other ongoing topics. To
1429 navigate these potential conflicts effectively, follow the recommended
1430 steps outlined below:</p></div>
1431 <div class="olist arabic"><ol class="arabic">
1432 <li>
1434 Build on a suitable base branch, see the <a href="#choose-starting-point">section above</a>,
1435 and format-patch the series. If you are doing "rebase -i" in-place to
1436 update from the previous round, this will reuse the previous base so
1437 (2) and (3) may become trivial.
1438 </p>
1439 </li>
1440 <li>
1442 Find the base of where the last round was queued
1443 </p>
1444 <div class="literalblock">
1445 <div class="content">
1446 <pre><code>$ mine='kn/ref-transaction-symref'
1447 $ git checkout "origin/seen^{/^Merge branch '$mine'}...master"</code></pre>
1448 </div></div>
1449 </li>
1450 <li>
1452 Apply your format-patch result. There are two cases
1453 </p>
1454 <div class="olist loweralpha"><ol class="loweralpha">
1455 <li>
1457 Things apply cleanly and tests fine. Go to (4).
1458 </p>
1459 </li>
1460 <li>
1462 Things apply cleanly but does not build or test fails, or things do
1463 not apply cleanly.
1464 </p>
1465 <div class="paragraph"><p>In the latter case, you have textual or semantic conflicts coming from
1466 the difference between the old base and the base you used to build in
1467 (1). Identify what caused the breakages (e.g., a topic or two may have
1468 merged since the base used by (2) until the base used by (1)).</p></div>
1469 <div class="paragraph"><p>Check out the latest <em>origin/master</em> (which may be newer than the base
1470 used by (2)), "merge --no-ff" the topics you newly depend on in there,
1471 and use the result of the merge(s) as the base, rebuild the series and
1472 test again. Run format-patch from the last such merges to the tip of
1473 your topic. If you did</p></div>
1474 <div class="literalblock">
1475 <div class="content">
1476 <pre><code>$ git checkout origin/master
1477 $ git merge --no-ff --into-name kn/ref-transaction-symref fo/obar
1478 $ git merge --no-ff --into-name kn/ref-transaction-symref ba/zqux
1479 ... rebuild the topic ...</code></pre>
1480 </div></div>
1481 <div class="paragraph"><p>Then you&#8217;d just format your topic above these "preparing the ground"
1482 merges, e.g.</p></div>
1483 <div class="literalblock">
1484 <div class="content">
1485 <pre><code>$ git format-patch "HEAD^{/^Merge branch 'ba/zqux'}"..HEAD</code></pre>
1486 </div></div>
1487 <div class="paragraph"><p>Do not forget to write in the cover letter you did this, including the
1488 topics you have in your base on top of <em>master</em>. Then go to (4).</p></div>
1489 </li>
1490 </ol></div>
1491 </li>
1492 <li>
1494 Make a trial merge of your topic into <em>next</em> and <em>seen</em>, e.g.
1495 </p>
1496 <div class="literalblock">
1497 <div class="content">
1498 <pre><code>$ git checkout --detach 'origin/seen'
1499 $ git revert -m 1 &lt;the merge of the previous iteration into seen&gt;
1500 $ git merge kn/ref-transaction-symref</code></pre>
1501 </div></div>
1502 <div class="paragraph"><p>The "revert" is needed if the previous iteration of your topic is
1503 already in <em>seen</em> (like in this case). You could choose to rebuild
1504 master..origin/seen from scratch while excluding your previous
1505 iteration, which may emulate what happens on the maintainers end more
1506 closely.</p></div>
1507 <div class="paragraph"><p>This trial merge may conflict. It is primarily to see what conflicts
1508 <em>other</em> topics may have with your topic. In other words, you do not
1509 have to depend on it to make your topic work on <em>master</em>. It may
1510 become the job of the other topic owners to resolve conflicts if your
1511 topic goes to <em>next</em> before theirs.</p></div>
1512 <div class="paragraph"><p>Make a note on what conflict you saw in the cover letter. You do not
1513 necessarily have to resolve them, but it would be a good opportunity to
1514 learn what others are doing in related areas.</p></div>
1515 <div class="literalblock">
1516 <div class="content">
1517 <pre><code>$ git checkout --detach 'origin/next'
1518 $ git merge kn/ref-transaction-symref</code></pre>
1519 </div></div>
1520 <div class="paragraph"><p>This is to see what conflicts your topic has with other topics that are
1521 already cooking. This should not conflict if (3)-2 prepared a base on
1522 top of updated master plus dependent topics taken from <em>next</em>. Unless
1523 the context is severe (one way to tell is try the same trial merge with
1524 your old iteration, which may conflict in a similar way), expect that it
1525 will be handled on maintainers end (if it gets unmanageable, I&#8217;ll ask to
1526 rebase when I receive your patches).</p></div>
1527 </li>
1528 </ol></div>
1529 </div>
1530 </div>
1531 </div>
1532 <div class="sect1">
1533 <h2 id="_subsystems_with_dedicated_maintainers">Subsystems with dedicated maintainers</h2>
1534 <div class="sectionbody">
1535 <div class="paragraph"><p>Some parts of the system have dedicated maintainers with their own
1536 repositories.</p></div>
1537 <div class="ulist"><ul>
1538 <li>
1540 <code>git-gui/</code> comes from git-gui project, maintained by Johannes Sixt:
1541 </p>
1542 <div class="literalblock">
1543 <div class="content">
1544 <pre><code>https://github.com/j6t/git-gui</code></pre>
1545 </div></div>
1546 </li>
1547 <li>
1549 <code>gitk-git/</code> comes from Paul Mackerras&#8217;s gitk project:
1550 </p>
1551 <div class="literalblock">
1552 <div class="content">
1553 <pre><code>git://git.ozlabs.org/~paulus/gitk</code></pre>
1554 </div></div>
1555 <div class="literalblock">
1556 <div class="content">
1557 <pre><code>Those who are interested in improving gitk can volunteer to help Paul
1558 maintain it, cf. &lt;YntxL/fTplFm8lr6@cleo&gt;.</code></pre>
1559 </div></div>
1560 </li>
1561 <li>
1563 <code>po/</code> comes from the localization coordinator, Jiang Xin:
1564 </p>
1565 <div class="literalblock">
1566 <div class="content">
1567 <pre><code>https://github.com/git-l10n/git-po/</code></pre>
1568 </div></div>
1569 </li>
1570 </ul></div>
1571 <div class="paragraph"><p>Patches to these parts should be based on their trees.</p></div>
1572 <div class="ulist"><ul>
1573 <li>
1575 The "Git documentation translations" project, led by Jean-Noël
1576 Avila, translates our documentation pages. Their work products are
1577 maintained separately from this project, not as part of our tree:
1578 </p>
1579 <div class="literalblock">
1580 <div class="content">
1581 <pre><code>https://github.com/jnavila/git-manpages-l10n/</code></pre>
1582 </div></div>
1583 </li>
1584 </ul></div>
1585 </div>
1586 </div>
1587 <div class="sect1">
1588 <h2 id="_github_ci_a_id_ghci_a">GitHub CI<a id="GHCI"></a></h2>
1589 <div class="sectionbody">
1590 <div class="paragraph"><p>With an account at GitHub, you can use GitHub CI to test your changes
1591 on Linux, Mac and Windows. See
1592 <a href="https://github.com/git/git/actions/workflows/main.yml">https://github.com/git/git/actions/workflows/main.yml</a> for examples of
1593 recent CI runs.</p></div>
1594 <div class="paragraph"><p>Follow these steps for the initial setup:</p></div>
1595 <div class="olist arabic"><ol class="arabic">
1596 <li>
1598 Fork <a href="https://github.com/git/git">https://github.com/git/git</a> to your GitHub account.
1599 You can find detailed instructions how to fork here:
1600 <a href="https://help.github.com/articles/fork-a-repo/">https://help.github.com/articles/fork-a-repo/</a>
1601 </p>
1602 </li>
1603 </ol></div>
1604 <div class="paragraph"><p>After the initial setup, CI will run whenever you push new changes
1605 to your fork of Git on GitHub. You can monitor the test state of all your
1606 branches here: <code>https://github.com/&lt;Your GitHub handle&gt;/git/actions/workflows/main.yml</code></p></div>
1607 <div class="paragraph"><p>If a branch does not pass all test cases then it will be marked with a
1608 red <code>x</code>, instead of a green check. In that case, you can click on the
1609 failing job and navigate to "ci/run-build-and-tests.sh" and/or
1610 "ci/print-test-failures.sh". You can also download "Artifacts" which
1611 are zip archives containing tarred (or zipped) archives with test data
1612 relevant for debugging.</p></div>
1613 <div class="paragraph"><p>Then fix the problem and push your fix to your GitHub fork. This will
1614 trigger a new CI build to ensure all tests pass.</p></div>
1615 </div>
1616 </div>
1617 <div class="sect1">
1618 <h2 id="mua">MUA specific hints</h2>
1619 <div class="sectionbody">
1620 <div class="paragraph"><p>Some of the patches I receive or pick up from the list share common
1621 patterns of breakage. Please make sure your MUA is set up
1622 properly not to corrupt whitespaces.</p></div>
1623 <div class="paragraph"><p>See the DISCUSSION section of <a href="git-format-patch.html">git-format-patch(1)</a> for hints on
1624 checking your patch by mailing it to yourself and applying with
1625 <a href="git-am.html">git-am(1)</a>.</p></div>
1626 <div class="paragraph"><p>While you are at it, check the resulting commit log message from
1627 a trial run of applying the patch. If what is in the resulting
1628 commit is not exactly what you would want to see, it is very
1629 likely that your maintainer would end up hand editing the log
1630 message when he applies your patch. Things like "Hi, this is my
1631 first patch.\n", if you really want to put in the patch e-mail,
1632 should come after the three-dash line that signals the end of the
1633 commit message.</p></div>
1634 <div class="sect2">
1635 <h3 id="_pine">Pine</h3>
1636 <div class="paragraph"><p>(Johannes Schindelin)</p></div>
1637 <div class="literalblock">
1638 <div class="content">
1639 <pre><code>I don't know how many people still use pine, but for those poor
1640 souls it may be good to mention that the quell-flowed-text is
1641 needed for recent versions.
1643 ... the "no-strip-whitespace-before-send" option, too. AFAIK it
1644 was introduced in 4.60.</code></pre>
1645 </div></div>
1646 <div class="paragraph"><p>(Linus Torvalds)</p></div>
1647 <div class="literalblock">
1648 <div class="content">
1649 <pre><code>And 4.58 needs at least this.
1651 diff-tree 8326dd8350be64ac7fc805f6563a1d61ad10d32c (from e886a61f76edf5410573e92e38ce22974f9c40f1)
1652 Author: Linus Torvalds &lt;torvalds@g5.osdl.org&gt;
1653 Date: Mon Aug 15 17:23:51 2005 -0700
1655 Fix pine whitespace-corruption bug
1657 There's no excuse for unconditionally removing whitespace from
1658 the pico buffers on close.
1660 diff --git a/pico/pico.c b/pico/pico.c
1661 --- a/pico/pico.c
1662 +++ b/pico/pico.c
1663 @@ -219,7 +219,9 @@ PICO *pm;
1664 switch(pico_all_done){ /* prepare for/handle final events */
1665 case COMP_EXIT : /* already confirmed */
1666 packheader();
1667 +#if 0
1668 stripwhitespace();
1669 +#endif
1670 c |= COMP_EXIT;
1671 break;</code></pre>
1672 </div></div>
1673 <div class="paragraph"><p>(Daniel Barkalow)</p></div>
1674 <div class="literalblock">
1675 <div class="content">
1676 <pre><code>&gt; A patch to SubmittingPatches, MUA specific help section for
1677 &gt; users of Pine 4.63 would be very much appreciated.
1679 Ah, it looks like a recent version changed the default behavior to do the
1680 right thing, and inverted the sense of the configuration option. (Either
1681 that or Gentoo did it.) So you need to set the
1682 "no-strip-whitespace-before-send" option, unless the option you have is
1683 "strip-whitespace-before-send", in which case you should avoid checking
1684 it.</code></pre>
1685 </div></div>
1686 </div>
1687 <div class="sect2">
1688 <h3 id="_thunderbird_kmail_gmail">Thunderbird, KMail, GMail</h3>
1689 <div class="paragraph"><p>See the MUA-SPECIFIC HINTS section of <a href="git-format-patch.html">git-format-patch(1)</a>.</p></div>
1690 </div>
1691 <div class="sect2">
1692 <h3 id="_gnus">Gnus</h3>
1693 <div class="paragraph"><p>"|" in the <code>*Summary*</code> buffer can be used to pipe the current
1694 message to an external program, and this is a handy way to drive
1695 <code>git am</code>. However, if the message is MIME encoded, what is
1696 piped into the program is the representation you see in your
1697 <code>*Article*</code> buffer after unwrapping MIME. This is often not what
1698 you would want for two reasons. It tends to screw up non-ASCII
1699 characters (most notably in people&#8217;s names), and also
1700 whitespaces (fatal in patches). Running "C-u g" to display the
1701 message in raw form before using "|" to run the pipe can work
1702 this problem around.</p></div>
1703 </div>
1704 </div>
1705 </div>
1706 </div>
1707 <div id="footnotes"><hr /></div>
1708 <div id="footer">
1709 <div id="footer-text">
1710 Last updated
1711 2024-05-28 13:39:08 PDT
1712 </div>
1713 </div>
1714 </body>
1715 </html>