Autogenerated HTML docs for v2.42.0-325-g3a063
[git-htmldocs.git] / giteveryday.html
blob6863bd515a6a4df488e785f89b29d1053e5860ba
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>giteveryday(7)</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="manpage">
736 <div id="header">
737 <h1>
738 giteveryday(7) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>giteveryday -
743 A useful minimum set of commands for Everyday Git
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="paragraph"><p>Everyday Git With 20 Commands Or So</p></div>
752 </div>
753 </div>
754 <div class="sect1">
755 <h2 id="_description">DESCRIPTION</h2>
756 <div class="sectionbody">
757 <div class="paragraph"><p>Git users can broadly be grouped into four categories for the purposes of
758 describing here a small set of useful command for everyday Git.</p></div>
759 <div class="ulist"><ul>
760 <li>
762 <a href="#STANDALONE">Individual Developer (Standalone)</a> commands are essential
763 for anybody who makes a commit, even for somebody who works alone.
764 </p>
765 </li>
766 <li>
768 If you work with other people, you will need commands listed in
769 the <a href="#PARTICIPANT">Individual Developer (Participant)</a> section as well.
770 </p>
771 </li>
772 <li>
774 People who play the <a href="#INTEGRATOR">Integrator</a> role need to learn some
775 more commands in addition to the above.
776 </p>
777 </li>
778 <li>
780 <a href="#ADMINISTRATION">Repository Administration</a> commands are for system
781 administrators who are responsible for the care and feeding
782 of Git repositories.
783 </p>
784 </li>
785 </ul></div>
786 </div>
787 </div>
788 <div class="sect1">
789 <h2 id="_individual_developer_standalone_a_id_standalone_a">Individual Developer (Standalone)<a id="STANDALONE"></a></h2>
790 <div class="sectionbody">
791 <div class="paragraph"><p>A standalone individual developer does not exchange patches with
792 other people, and works alone in a single repository, using the
793 following commands.</p></div>
794 <div class="ulist"><ul>
795 <li>
797 <a href="git-init.html">git-init(1)</a> to create a new repository.
798 </p>
799 </li>
800 <li>
802 <a href="git-log.html">git-log(1)</a> to see what happened.
803 </p>
804 </li>
805 <li>
807 <a href="git-switch.html">git-switch(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch
808 branches.
809 </p>
810 </li>
811 <li>
813 <a href="git-add.html">git-add(1)</a> to manage the index file.
814 </p>
815 </li>
816 <li>
818 <a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what
819 you are in the middle of doing.
820 </p>
821 </li>
822 <li>
824 <a href="git-commit.html">git-commit(1)</a> to advance the current branch.
825 </p>
826 </li>
827 <li>
829 <a href="git-restore.html">git-restore(1)</a> to undo changes.
830 </p>
831 </li>
832 <li>
834 <a href="git-merge.html">git-merge(1)</a> to merge between local branches.
835 </p>
836 </li>
837 <li>
839 <a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches.
840 </p>
841 </li>
842 <li>
844 <a href="git-tag.html">git-tag(1)</a> to mark a known point.
845 </p>
846 </li>
847 </ul></div>
848 <div class="sect2">
849 <h3 id="_examples">Examples</h3>
850 <div class="dlist"><dl>
851 <dt class="hdlist1">
852 Use a tarball as a starting point for a new repository.
853 </dt>
854 <dd>
855 <div class="listingblock">
856 <div class="content">
857 <pre><code>$ tar zxf frotz.tar.gz
858 $ cd frotz
859 $ git init
860 $ git add . <b>&lt;1&gt;</b>
861 $ git commit -m "import of frotz source tree."
862 $ git tag v2.43 <b>&lt;2&gt;</b></code></pre>
863 </div></div>
864 <div class="colist arabic"><ol>
865 <li>
867 add everything under the current directory.
868 </p>
869 </li>
870 <li>
872 make a lightweight, unannotated tag.
873 </p>
874 </li>
875 </ol></div>
876 </dd>
877 <dt class="hdlist1">
878 Create a topic branch and develop.
879 </dt>
880 <dd>
881 <div class="listingblock">
882 <div class="content">
883 <pre><code>$ git switch -c alsa-audio <b>&lt;1&gt;</b>
884 $ edit/compile/test
885 $ git restore curses/ux_audio_oss.c <b>&lt;2&gt;</b>
886 $ git add curses/ux_audio_alsa.c <b>&lt;3&gt;</b>
887 $ edit/compile/test
888 $ git diff HEAD <b>&lt;4&gt;</b>
889 $ git commit -a -s <b>&lt;5&gt;</b>
890 $ edit/compile/test
891 $ git diff HEAD^ <b>&lt;6&gt;</b>
892 $ git commit -a --amend <b>&lt;7&gt;</b>
893 $ git switch master <b>&lt;8&gt;</b>
894 $ git merge alsa-audio <b>&lt;9&gt;</b>
895 $ git log --since='3 days ago' <b>&lt;10&gt;</b>
896 $ git log v2.43.. curses/ <b>&lt;11&gt;</b></code></pre>
897 </div></div>
898 <div class="colist arabic"><ol>
899 <li>
901 create a new topic branch.
902 </p>
903 </li>
904 <li>
906 revert your botched changes in <code>curses/ux_audio_oss.c</code>.
907 </p>
908 </li>
909 <li>
911 you need to tell Git if you added a new file; removal and
912 modification will be caught if you do <code>git commit -a</code> later.
913 </p>
914 </li>
915 <li>
917 to see what changes you are committing.
918 </p>
919 </li>
920 <li>
922 commit everything, as you have tested, with your sign-off.
923 </p>
924 </li>
925 <li>
927 look at all your changes including the previous commit.
928 </p>
929 </li>
930 <li>
932 amend the previous commit, adding all your new changes,
933 using your original message.
934 </p>
935 </li>
936 <li>
938 switch to the master branch.
939 </p>
940 </li>
941 <li>
943 merge a topic branch into your master branch.
944 </p>
945 </li>
946 <li>
948 review commit logs; other forms to limit output can be
949 combined and include <code>-10</code> (to show up to 10 commits),
950 <code>--until=2005-12-10</code>, etc.
951 </p>
952 </li>
953 <li>
955 view only the changes that touch what&#8217;s in <code>curses/</code>
956 directory, since <code>v2.43</code> tag.
957 </p>
958 </li>
959 </ol></div>
960 </dd>
961 </dl></div>
962 </div>
963 </div>
964 </div>
965 <div class="sect1">
966 <h2 id="_individual_developer_participant_a_id_participant_a">Individual Developer (Participant)<a id="PARTICIPANT"></a></h2>
967 <div class="sectionbody">
968 <div class="paragraph"><p>A developer working as a participant in a group project needs to
969 learn how to communicate with others, and uses these commands in
970 addition to the ones needed by a standalone developer.</p></div>
971 <div class="ulist"><ul>
972 <li>
974 <a href="git-clone.html">git-clone(1)</a> from the upstream to prime your local
975 repository.
976 </p>
977 </li>
978 <li>
980 <a href="git-pull.html">git-pull(1)</a> and <a href="git-fetch.html">git-fetch(1)</a> from "origin"
981 to keep up-to-date with the upstream.
982 </p>
983 </li>
984 <li>
986 <a href="git-push.html">git-push(1)</a> to shared repository, if you adopt CVS
987 style shared repository workflow.
988 </p>
989 </li>
990 <li>
992 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare e-mail submission, if
993 you adopt Linux kernel-style public forum workflow.
994 </p>
995 </li>
996 <li>
998 <a href="git-send-email.html">git-send-email(1)</a> to send your e-mail submission without
999 corruption by your MUA.
1000 </p>
1001 </li>
1002 <li>
1004 <a href="git-request-pull.html">git-request-pull(1)</a> to create a summary of changes
1005 for your upstream to pull.
1006 </p>
1007 </li>
1008 </ul></div>
1009 <div class="sect2">
1010 <h3 id="_examples_2">Examples</h3>
1011 <div class="dlist"><dl>
1012 <dt class="hdlist1">
1013 Clone the upstream and work on it. Feed changes to upstream.
1014 </dt>
1015 <dd>
1016 <div class="listingblock">
1017 <div class="content">
1018 <pre><code>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
1019 $ cd my2.6
1020 $ git switch -c mine master <b>&lt;1&gt;</b>
1021 $ edit/compile/test; git commit -a -s <b>&lt;2&gt;</b>
1022 $ git format-patch master <b>&lt;3&gt;</b>
1023 $ git send-email --to="person &lt;email@example.com&gt;" 00*.patch <b>&lt;4&gt;</b>
1024 $ git switch master <b>&lt;5&gt;</b>
1025 $ git pull <b>&lt;6&gt;</b>
1026 $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <b>&lt;7&gt;</b>
1027 $ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git <b>&lt;8&gt;</b>
1028 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <b>&lt;9&gt;</b>
1029 $ git reset --hard ORIG_HEAD <b>&lt;10&gt;</b>
1030 $ git gc <b>&lt;11&gt;</b></code></pre>
1031 </div></div>
1032 <div class="colist arabic"><ol>
1033 <li>
1035 checkout a new branch <code>mine</code> from master.
1036 </p>
1037 </li>
1038 <li>
1040 repeat as needed.
1041 </p>
1042 </li>
1043 <li>
1045 extract patches from your branch, relative to master,
1046 </p>
1047 </li>
1048 <li>
1050 and email them.
1051 </p>
1052 </li>
1053 <li>
1055 return to <code>master</code>, ready to see what&#8217;s new
1056 </p>
1057 </li>
1058 <li>
1060 <code>git pull</code> fetches from <code>origin</code> by default and merges into the
1061 current branch.
1062 </p>
1063 </li>
1064 <li>
1066 immediately after pulling, look at the changes done upstream
1067 since last time we checked, only in the
1068 area we are interested in.
1069 </p>
1070 </li>
1071 <li>
1073 check the branch names in an external repository (if not known).
1074 </p>
1075 </li>
1076 <li>
1078 fetch from a specific branch <code>ALL</code> from a specific repository
1079 and merge it.
1080 </p>
1081 </li>
1082 <li>
1084 revert the pull.
1085 </p>
1086 </li>
1087 <li>
1089 garbage collect leftover objects from reverted pull.
1090 </p>
1091 </li>
1092 </ol></div>
1093 </dd>
1094 <dt class="hdlist1">
1095 Push into another repository.
1096 </dt>
1097 <dd>
1098 <div class="listingblock">
1099 <div class="content">
1100 <pre><code>satellite$ git clone mothership:frotz frotz <b>&lt;1&gt;</b>
1101 satellite$ cd frotz
1102 satellite$ git config --get-regexp '^(remote|branch)\.' <b>&lt;2&gt;</b>
1103 remote.origin.url mothership:frotz
1104 remote.origin.fetch refs/heads/*:refs/remotes/origin/*
1105 branch.master.remote origin
1106 branch.master.merge refs/heads/master
1107 satellite$ git config remote.origin.push \
1108 +refs/heads/*:refs/remotes/satellite/* <b>&lt;3&gt;</b>
1109 satellite$ edit/compile/test/commit
1110 satellite$ git push origin <b>&lt;4&gt;</b>
1112 mothership$ cd frotz
1113 mothership$ git switch master
1114 mothership$ git merge satellite/master <b>&lt;5&gt;</b></code></pre>
1115 </div></div>
1116 <div class="colist arabic"><ol>
1117 <li>
1119 mothership machine has a frotz repository under your home
1120 directory; clone from it to start a repository on the satellite
1121 machine.
1122 </p>
1123 </li>
1124 <li>
1126 clone sets these configuration variables by default.
1127 It arranges <code>git pull</code> to fetch and store the branches of mothership
1128 machine to local <code>remotes/origin/*</code> remote-tracking branches.
1129 </p>
1130 </li>
1131 <li>
1133 arrange <code>git push</code> to push all local branches to
1134 their corresponding branch of the mothership machine.
1135 </p>
1136 </li>
1137 <li>
1139 push will stash all our work away on <code>remotes/satellite/*</code>
1140 remote-tracking branches on the mothership machine. You could use this
1141 as a back-up method. Likewise, you can pretend that mothership
1142 "fetched" from you (useful when access is one sided).
1143 </p>
1144 </li>
1145 <li>
1147 on mothership machine, merge the work done on the satellite
1148 machine into the master branch.
1149 </p>
1150 </li>
1151 </ol></div>
1152 </dd>
1153 <dt class="hdlist1">
1154 Branch off of a specific tag.
1155 </dt>
1156 <dd>
1157 <div class="listingblock">
1158 <div class="content">
1159 <pre><code>$ git switch -c private2.6.14 v2.6.14 <b>&lt;1&gt;</b>
1160 $ edit/compile/test; git commit -a
1161 $ git checkout master
1162 $ git cherry-pick v2.6.14..private2.6.14 <b>&lt;2&gt;</b></code></pre>
1163 </div></div>
1164 <div class="colist arabic"><ol>
1165 <li>
1167 create a private branch based on a well known (but somewhat behind)
1168 tag.
1169 </p>
1170 </li>
1171 <li>
1173 forward port all changes in <code>private2.6.14</code> branch to <code>master</code> branch
1174 without a formal "merging". Or longhand<br />
1175 <code>git format-patch -k -m --stdout v2.6.14..private2.6.14 |
1176 git am -3 -k</code>
1177 </p>
1178 </li>
1179 </ol></div>
1180 </dd>
1181 </dl></div>
1182 <div class="paragraph"><p>An alternate participant submission mechanism is using the
1183 <code>git request-pull</code> or pull-request mechanisms (e.g as used on
1184 GitHub (www.github.com) to notify your upstream of your
1185 contribution.</p></div>
1186 </div>
1187 </div>
1188 </div>
1189 <div class="sect1">
1190 <h2 id="_integrator_a_id_integrator_a">Integrator<a id="INTEGRATOR"></a></h2>
1191 <div class="sectionbody">
1192 <div class="paragraph"><p>A fairly central person acting as the integrator in a group
1193 project receives changes made by others, reviews and integrates
1194 them and publishes the result for others to use, using these
1195 commands in addition to the ones needed by participants.</p></div>
1196 <div class="paragraph"><p>This section can also be used by those who respond to <code>git
1197 request-pull</code> or pull-request on GitHub (www.github.com) to
1198 integrate the work of others into their history. A sub-area
1199 lieutenant for a repository will act both as a participant and
1200 as an integrator.</p></div>
1201 <div class="ulist"><ul>
1202 <li>
1204 <a href="git-am.html">git-am(1)</a> to apply patches e-mailed in from your
1205 contributors.
1206 </p>
1207 </li>
1208 <li>
1210 <a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants.
1211 </p>
1212 </li>
1213 <li>
1215 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare and send suggested
1216 alternative to contributors.
1217 </p>
1218 </li>
1219 <li>
1221 <a href="git-revert.html">git-revert(1)</a> to undo botched commits.
1222 </p>
1223 </li>
1224 <li>
1226 <a href="git-push.html">git-push(1)</a> to publish the bleeding edge.
1227 </p>
1228 </li>
1229 </ul></div>
1230 <div class="sect2">
1231 <h3 id="_examples_3">Examples</h3>
1232 <div class="dlist"><dl>
1233 <dt class="hdlist1">
1234 A typical integrator&#8217;s Git day.
1235 </dt>
1236 <dd>
1237 <div class="listingblock">
1238 <div class="content">
1239 <pre><code>$ git status <b>&lt;1&gt;</b>
1240 $ git branch --no-merged master <b>&lt;2&gt;</b>
1241 $ mailx <b>&lt;3&gt;</b>
1242 &amp; s 2 3 4 5 ./+to-apply
1243 &amp; s 7 8 ./+hold-linus
1244 &amp; q
1245 $ git switch -c topic/one master
1246 $ git am -3 -i -s ./+to-apply <b>&lt;4&gt;</b>
1247 $ compile/test
1248 $ git switch -c hold/linus &amp;&amp; git am -3 -i -s ./+hold-linus <b>&lt;5&gt;</b>
1249 $ git switch topic/one &amp;&amp; git rebase master <b>&lt;6&gt;</b>
1250 $ git switch -C seen next <b>&lt;7&gt;</b>
1251 $ git merge topic/one topic/two &amp;&amp; git merge hold/linus <b>&lt;8&gt;</b>
1252 $ git switch maint
1253 $ git cherry-pick master~4 <b>&lt;9&gt;</b>
1254 $ compile/test
1255 $ git tag -s -m "GIT 0.99.9x" v0.99.9x <b>&lt;10&gt;</b>
1256 $ git fetch ko &amp;&amp; for branch in master maint next seen <b>&lt;11&gt;</b>
1258 git show-branch ko/$branch $branch <b>&lt;12&gt;</b>
1259 done
1260 $ git push --follow-tags ko <b>&lt;13&gt;</b></code></pre>
1261 </div></div>
1262 <div class="colist arabic"><ol>
1263 <li>
1265 see what you were in the middle of doing, if anything.
1266 </p>
1267 </li>
1268 <li>
1270 see which branches haven&#8217;t been merged into <code>master</code> yet.
1271 Likewise for any other integration branches e.g. <code>maint</code>, <code>next</code>
1272 and <code>seen</code>.
1273 </p>
1274 </li>
1275 <li>
1277 read mails, save ones that are applicable, and save others
1278 that are not quite ready (other mail readers are available).
1279 </p>
1280 </li>
1281 <li>
1283 apply them, interactively, with your sign-offs.
1284 </p>
1285 </li>
1286 <li>
1288 create topic branch as needed and apply, again with sign-offs.
1289 </p>
1290 </li>
1291 <li>
1293 rebase internal topic branch that has not been merged to the
1294 master or exposed as a part of a stable branch.
1295 </p>
1296 </li>
1297 <li>
1299 restart <code>seen</code> every time from the next.
1300 </p>
1301 </li>
1302 <li>
1304 and bundle topic branches still cooking.
1305 </p>
1306 </li>
1307 <li>
1309 backport a critical fix.
1310 </p>
1311 </li>
1312 <li>
1314 create a signed tag.
1315 </p>
1316 </li>
1317 <li>
1319 make sure master was not accidentally rewound beyond that
1320 already pushed out.
1321 </p>
1322 </li>
1323 <li>
1325 In the output from <code>git show-branch</code>, <code>master</code> should have
1326 everything <code>ko/master</code> has, and <code>next</code> should have
1327 everything <code>ko/next</code> has, etc.
1328 </p>
1329 </li>
1330 <li>
1332 push out the bleeding edge, together with new tags that point
1333 into the pushed history.
1334 </p>
1335 </li>
1336 </ol></div>
1337 </dd>
1338 </dl></div>
1339 <div class="paragraph"><p>In this example, the <code>ko</code> shorthand points at the Git maintainer&#8217;s
1340 repository at kernel.org, and looks like this:</p></div>
1341 <div class="listingblock">
1342 <div class="content">
1343 <pre><code>(in .git/config)
1344 [remote "ko"]
1345 url = kernel.org:/pub/scm/git/git.git
1346 fetch = refs/heads/*:refs/remotes/ko/*
1347 push = refs/heads/master
1348 push = refs/heads/next
1349 push = +refs/heads/seen
1350 push = refs/heads/maint</code></pre>
1351 </div></div>
1352 </div>
1353 </div>
1354 </div>
1355 <div class="sect1">
1356 <h2 id="_repository_administration_a_id_administration_a">Repository Administration<a id="ADMINISTRATION"></a></h2>
1357 <div class="sectionbody">
1358 <div class="paragraph"><p>A repository administrator uses the following tools to set up
1359 and maintain access to the repository by developers.</p></div>
1360 <div class="ulist"><ul>
1361 <li>
1363 <a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from
1364 repository.
1365 </p>
1366 </li>
1367 <li>
1369 <a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em>
1370 for shared central repository users.
1371 </p>
1372 </li>
1373 <li>
1375 <a href="git-http-backend.html">git-http-backend(1)</a> provides a server side implementation
1376 of Git-over-HTTP ("Smart http") allowing both fetch and push services.
1377 </p>
1378 </li>
1379 <li>
1381 <a href="gitweb.html">gitweb(1)</a> provides a web front-end to Git repositories,
1382 which can be set-up using the <a href="git-instaweb.html">git-instaweb(1)</a> script.
1383 </p>
1384 </li>
1385 </ul></div>
1386 <div class="paragraph"><p><a href="howto/update-hook-example.html">update hook howto</a> has a good
1387 example of managing a shared central repository.</p></div>
1388 <div class="paragraph"><p>In addition there are a number of other widely deployed hosting, browsing
1389 and reviewing solutions such as:</p></div>
1390 <div class="ulist"><ul>
1391 <li>
1393 gitolite, gerrit code review, cgit and others.
1394 </p>
1395 </li>
1396 </ul></div>
1397 <div class="sect2">
1398 <h3 id="_examples_4">Examples</h3>
1399 <div class="dlist"><dl>
1400 <dt class="hdlist1">
1401 We assume the following in /etc/services
1402 </dt>
1403 <dd>
1404 <div class="listingblock">
1405 <div class="content">
1406 <pre><code>$ grep 9418 /etc/services
1407 git 9418/tcp # Git Version Control System</code></pre>
1408 </div></div>
1409 </dd>
1410 <dt class="hdlist1">
1411 Run git-daemon to serve /pub/scm from inetd.
1412 </dt>
1413 <dd>
1414 <div class="listingblock">
1415 <div class="content">
1416 <pre><code>$ grep git /etc/inetd.conf
1417 git stream tcp nowait nobody \
1418 /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</code></pre>
1419 </div></div>
1420 <div class="paragraph"><p>The actual configuration line should be on one line.</p></div>
1421 </dd>
1422 <dt class="hdlist1">
1423 Run git-daemon to serve /pub/scm from xinetd.
1424 </dt>
1425 <dd>
1426 <div class="listingblock">
1427 <div class="content">
1428 <pre><code>$ cat /etc/xinetd.d/git-daemon
1429 # default: off
1430 # description: The Git server offers access to Git repositories
1431 service git
1433 disable = no
1434 type = UNLISTED
1435 port = 9418
1436 socket_type = stream
1437 wait = no
1438 user = nobody
1439 server = /usr/bin/git-daemon
1440 server_args = --inetd --export-all --base-path=/pub/scm
1441 log_on_failure += USERID
1442 }</code></pre>
1443 </div></div>
1444 <div class="paragraph"><p>Check your xinetd(8) documentation and setup, this is from a Fedora system.
1445 Others might be different.</p></div>
1446 </dd>
1447 <dt class="hdlist1">
1448 Give push/pull only access to developers using git-over-ssh.
1449 </dt>
1450 <dd>
1452 e.g. those using:
1453 <code>$ git push/pull ssh://host.xz/pub/scm/project</code>
1454 </p>
1455 <div class="listingblock">
1456 <div class="content">
1457 <pre><code>$ grep git /etc/passwd <b>&lt;1&gt;</b>
1458 alice:x:1000:1000::/home/alice:/usr/bin/git-shell
1459 bob:x:1001:1001::/home/bob:/usr/bin/git-shell
1460 cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
1461 david:x:1003:1003::/home/david:/usr/bin/git-shell
1462 $ grep git /etc/shells <b>&lt;2&gt;</b>
1463 /usr/bin/git-shell</code></pre>
1464 </div></div>
1465 <div class="colist arabic"><ol>
1466 <li>
1468 log-in shell is set to /usr/bin/git-shell, which does not
1469 allow anything but <code>git push</code> and <code>git pull</code>. The users require
1470 ssh access to the machine.
1471 </p>
1472 </li>
1473 <li>
1475 in many distributions /etc/shells needs to list what is used
1476 as the login shell.
1477 </p>
1478 </li>
1479 </ol></div>
1480 </dd>
1481 <dt class="hdlist1">
1482 CVS-style shared repository.
1483 </dt>
1484 <dd>
1485 <div class="listingblock">
1486 <div class="content">
1487 <pre><code>$ grep git /etc/group <b>&lt;1&gt;</b>
1488 git:x:9418:alice,bob,cindy,david
1489 $ cd /home/devo.git
1490 $ ls -l <b>&lt;2&gt;</b>
1491 lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -&gt; refs/heads/master
1492 drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches
1493 -rw-rw-r-- 1 david git 84 Dec 4 22:40 config
1494 -rw-rw-r-- 1 david git 58 Dec 4 22:40 description
1495 drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks
1496 -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index
1497 drwxrwsr-x 2 david git 4096 Dec 4 22:40 info
1498 drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects
1499 drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs
1500 drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes
1501 $ ls -l hooks/update <b>&lt;3&gt;</b>
1502 -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update
1503 $ cat info/allowed-users <b>&lt;4&gt;</b>
1504 refs/heads/master alice\|cindy
1505 refs/heads/doc-update bob
1506 refs/tags/v[0-9]* david</code></pre>
1507 </div></div>
1508 <div class="colist arabic"><ol>
1509 <li>
1511 place the developers into the same git group.
1512 </p>
1513 </li>
1514 <li>
1516 and make the shared repository writable by the group.
1517 </p>
1518 </li>
1519 <li>
1521 use update-hook example by Carl from Documentation/howto/
1522 for branch policy control.
1523 </p>
1524 </li>
1525 <li>
1527 alice and cindy can push into master, only bob can push into doc-update.
1528 david is the release manager and is the only person who can
1529 create and push version tags.
1530 </p>
1531 </li>
1532 </ol></div>
1533 </dd>
1534 </dl></div>
1535 </div>
1536 </div>
1537 </div>
1538 <div class="sect1">
1539 <h2 id="_git">GIT</h2>
1540 <div class="sectionbody">
1541 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1542 </div>
1543 </div>
1544 </div>
1545 <div id="footnotes"><hr /></div>
1546 <div id="footer">
1547 <div id="footer-text">
1548 Last updated
1549 2020-07-09 15:39:10 PDT
1550 </div>
1551 </div>
1552 </body>
1553 </html>