blob: bb922d78d2fc2553240d429fee2a619195aeb29f [file] [log] [blame]
Junio C Hamano944ce252018-05-30 22:25:261<?xml version="1.0" encoding="UTF-8"?>
Junio C Hamano446e30b2014-10-16 21:30:322<!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" />
Junio C Hamano98c882d2020-08-13 22:06:577<meta name="generator" content="AsciiDoc 9.0.0rc2" />
Junio C Hamano446e30b2014-10-16 21:30:328<title>giteveryday(7)</title>
9<style type="text/css">
10/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12/* Default font. */
13body {
14 font-family: Georgia,serif;
15}
16
17/* Title font. */
18h1, h2, h3, h4, h5, h6,
19div.title, caption.title,
20thead, p.table.header,
21#toctitle,
22#author, #revnumber, #revdate, #revremark,
23#footer {
24 font-family: Arial,Helvetica,sans-serif;
25}
26
27body {
28 margin: 1em 5% 1em 5%;
29}
30
31a {
32 color: blue;
33 text-decoration: underline;
34}
35a:visited {
36 color: fuchsia;
37}
38
39em {
40 font-style: italic;
41 color: navy;
42}
43
44strong {
45 font-weight: bold;
46 color: #083194;
47}
48
49h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54}
55
56h1, h2, h3 {
57 border-bottom: 2px solid silver;
58}
59h2 {
60 padding-top: 0.5em;
61}
62h3 {
63 float: left;
64}
65h3 + * {
66 clear: left;
67}
68h5 {
69 font-size: 1.0em;
70}
71
72div.sectionbody {
73 margin-left: 0;
74}
75
76hr {
77 border: 1px solid silver;
78}
79
80p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83}
84
85ul, ol, li > p {
86 margin-top: 0;
87}
88ul > li { color: #aaa; }
89ul > li > * { color: black; }
90
91.monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
97}
98pre {
99 white-space: pre-wrap;
100}
101
102#author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
106}
107#email {
108}
109#revnumber, #revdate, #revremark {
110}
111
112#footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117}
118#footer-text {
119 float: left;
120 padding-bottom: 0.5em;
121}
122#footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
125}
126
127#preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130}
131div.imageblock, div.exampleblock, div.verseblock,
132div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
136}
137div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
142}
143
144div.content { /* Block element content. */
145 padding: 0;
146}
147
148/* Block element titles. */
149div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155}
156div.title + * {
157 margin-top: 0;
158}
159
160td div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content div.title:first-child {
164 margin-top: 0.0em;
165}
166div.content + div.title {
167 margin-top: 0.0em;
168}
169
170div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
175}
176
177div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
182}
183
184div.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;
190}
191
192div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
195}
196
197div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
200}
201div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204}
205/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206div.verseblock + div.attribution {
207 text-align: left;
208}
209
210div.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;
217}
218div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
221}
222
223div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
226}
227
228div.imageblock div.content { padding-left: 0; }
229span.image img { border-style: none; vertical-align: text-bottom; }
230a.image:visited { color: white; }
231
232dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235}
236dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
241}
242dd > *:first-child {
243 margin-top: 0.1em;
244}
245
246ul, ol {
247 list-style-position: outside;
248}
249ol.arabic {
250 list-style-type: decimal;
251}
252ol.loweralpha {
253 list-style-type: lower-alpha;
254}
255ol.upperalpha {
256 list-style-type: upper-alpha;
257}
258ol.lowerroman {
259 list-style-type: lower-roman;
260}
261ol.upperroman {
262 list-style-type: upper-roman;
263}
264
265div.compact ul, div.compact ol,
266div.compact p, div.compact p,
267div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270}
271
272tfoot {
273 font-weight: bold;
274}
275td > div.verse {
276 white-space: pre;
277}
278
279div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282}
283div.hdlist tr {
284 padding-bottom: 15px;
285}
286dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288}
289td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
294}
295td.hdlist2 {
296 vertical-align: top;
297}
298div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301}
302
303.comment {
304 background: yellow;
305}
306
307.footnote, .footnoteref {
308 font-size: 0.8em;
309}
310
311span.footnote, span.footnoteref {
312 vertical-align: super;
313}
314
315#footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318}
319
320#footnotes div.footnote {
321 margin: 0 0 5px 0;
322}
323
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;
332}
333
334div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338}
339div.colist td img {
340 margin-top: 0.3em;
341}
342
343@media print {
344 #footer-badges { display: none; }
345}
346
347#toc {
348 margin-bottom: 2.5em;
349}
350
351#toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357}
358
359div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
362}
363div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366}
367div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370}
371div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374}
375
376span.aqua { color: aqua; }
377span.black { color: black; }
378span.blue { color: blue; }
379span.fuchsia { color: fuchsia; }
380span.gray { color: gray; }
381span.green { color: green; }
382span.lime { color: lime; }
383span.maroon { color: maroon; }
384span.navy { color: navy; }
385span.olive { color: olive; }
386span.purple { color: purple; }
387span.red { color: red; }
388span.silver { color: silver; }
389span.teal { color: teal; }
390span.white { color: white; }
391span.yellow { color: yellow; }
392
393span.aqua-background { background: aqua; }
394span.black-background { background: black; }
395span.blue-background { background: blue; }
396span.fuchsia-background { background: fuchsia; }
397span.gray-background { background: gray; }
398span.green-background { background: green; }
399span.lime-background { background: lime; }
400span.maroon-background { background: maroon; }
401span.navy-background { background: navy; }
402span.olive-background { background: olive; }
403span.purple-background { background: purple; }
404span.red-background { background: red; }
405span.silver-background { background: silver; }
406span.teal-background { background: teal; }
407span.white-background { background: white; }
408span.yellow-background { background: yellow; }
409
410span.big { font-size: 2em; }
411span.small { font-size: 0.6em; }
412
413span.underline { text-decoration: underline; }
414span.overline { text-decoration: overline; }
415span.line-through { text-decoration: line-through; }
416
417div.unbreakable { page-break-inside: avoid; }
418
419
420/*
421 * xhtml11 specific
422 *
423 * */
424
425div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428}
429div.tableblock > table {
430 border: 3px solid #527bbd;
431}
432thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435}
436p.table {
437 margin-top: 0;
438}
Junio C Hamano725b0da2020-01-22 22:02:40439/* Because the table frame attribute is overridden by CSS in most browsers. */
Junio C Hamano446e30b2014-10-16 21:30:32440div.tableblock > table[frame="void"] {
441 border-style: none;
442}
443div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446}
447div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450}
451
452
453/*
454 * html5 specific
455 *
456 * */
457
458table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461}
462thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465}
466p.tableblock {
467 margin-top: 0;
468}
469table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475}
476th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481}
482
483table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486}
487table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490}
491table.tableblock.frame-none {
492 border-style: hidden;
493}
494
495th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497}
498th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500}
501th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503}
504
505th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507}
508th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510}
511th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513}
514
515
516/*
517 * manpage specific
518 *
519 * */
520
521body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526}
527body.manpage h2 {
528 border-style: none;
529}
530body.manpage div.sectionbody {
531 margin-left: 3em;
532}
533
534@media print {
535 body.manpage div#toc { display: none; }
536}
537
538
539</style>
540<script type="text/javascript">
541/*<![CDATA[*/
542var asciidoc = { // Namespace.
543
544/////////////////////////////////////////////////////////////////////
545// Table Of Contents generator
546/////////////////////////////////////////////////////////////////////
547
548/* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
550 *
551 * Table Of Content generator
552 * Version: 0.4
553 *
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.
556 */
557
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
560
561// toclevels = 1..4.
562toc: function (toclevels) {
563
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);
571 }
572 return text;
573 }
574
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
579 }
580
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);
593 }
594 iterate(i);
595 }
596 }
597 }
598 iterate(el);
599 return result;
600 }
601
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
605 }
606
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);
616 }
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
619 }
620
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);
634 }
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
637},
638
639
640/////////////////////////////////////////////////////////////////////
641// Footnotes generator
642/////////////////////////////////////////////////////////////////////
643
644/* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
646 */
647
648footnotes: 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;
654 }
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);
660 }
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
663 }
664
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);
682 }
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;
689 }
690 }
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>]";
703 }
704 }
705 }
706},
707
708install: function(toclevels) {
709 var timerId;
710
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
715 }
716 }
717
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
721 }
722
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
728}
729
730}
731asciidoc.install();
732/*]]>*/
733</script>
734</head>
735<body class="manpage">
736<div id="header">
737<h1>
738giteveryday(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
758describing here a small set of useful command for everyday Git.</p></div>
759<div class="ulist"><ul>
760<li>
761<p>
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>
767<p>
768If 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>
773<p>
774People 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>
779<p>
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
792other people, and works alone in a single repository, using the
793following commands.</p></div>
794<div class="ulist"><ul>
795<li>
796<p>
797<a href="git-init.html">git-init(1)</a> to create a new repository.
798</p>
799</li>
800<li>
801<p>
802<a href="git-log.html">git-log(1)</a> to see what happened.
803</p>
804</li>
805<li>
806<p>
Junio C Hamanoc9f11c22019-07-10 02:54:04807<a href="git-switch.html">git-switch(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch
Junio C Hamano446e30b2014-10-16 21:30:32808 branches.
809</p>
810</li>
811<li>
812<p>
813<a href="git-add.html">git-add(1)</a> to manage the index file.
814</p>
815</li>
816<li>
817<p>
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>
823<p>
824<a href="git-commit.html">git-commit(1)</a> to advance the current branch.
825</p>
826</li>
827<li>
828<p>
Junio C Hamanoc9f11c22019-07-10 02:54:04829<a href="git-restore.html">git-restore(1)</a> to undo changes.
Junio C Hamano446e30b2014-10-16 21:30:32830</p>
831</li>
832<li>
833<p>
834<a href="git-merge.html">git-merge(1)</a> to merge between local branches.
835</p>
836</li>
837<li>
838<p>
839<a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches.
840</p>
841</li>
842<li>
843<p>
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">
852Use 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>
866<p>
867add everything under the current directory.
868</p>
869</li>
870<li>
871<p>
872make a lightweight, unannotated tag.
873</p>
874</li>
875</ol></div>
876</dd>
877<dt class="hdlist1">
878Create a topic branch and develop.
879</dt>
880<dd>
881<div class="listingblock">
882<div class="content">
Junio C Hamanoc9f11c22019-07-10 02:54:04883<pre><code>$ git switch -c alsa-audio <b>&lt;1&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:32884$ edit/compile/test
Junio C Hamanoc9f11c22019-07-10 02:54:04885$ git restore curses/ux_audio_oss.c <b>&lt;2&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:32886$ 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>
Junio C Hamanoc9f11c22019-07-10 02:54:04893$ git switch master <b>&lt;8&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:32894$ 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>
900<p>
901create a new topic branch.
902</p>
903</li>
904<li>
905<p>
906revert your botched changes in <code>curses/ux_audio_oss.c</code>.
907</p>
908</li>
909<li>
910<p>
911you need to tell Git if you added a new file; removal and
912modification will be caught if you do <code>git commit -a</code> later.
913</p>
914</li>
915<li>
916<p>
917to see what changes you are committing.
918</p>
919</li>
920<li>
921<p>
922commit everything, as you have tested, with your sign-off.
923</p>
924</li>
925<li>
926<p>
927look at all your changes including the previous commit.
928</p>
929</li>
930<li>
931<p>
932amend the previous commit, adding all your new changes,
933using your original message.
934</p>
935</li>
936<li>
937<p>
938switch to the master branch.
939</p>
940</li>
941<li>
942<p>
943merge a topic branch into your master branch.
944</p>
945</li>
946<li>
947<p>
948review commit logs; other forms to limit output can be
949combined 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>
954<p>
955view only the changes that touch what&#8217;s in <code>curses/</code>
956directory, 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
969learn how to communicate with others, and uses these commands in
970addition to the ones needed by a standalone developer.</p></div>
971<div class="ulist"><ul>
972<li>
973<p>
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>
979<p>
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>
985<p>
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>
991<p>
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>
997<p>
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>
1003<p>
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">
1013Clone 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
Junio C Hamanoc9f11c22019-07-10 02:54:041020$ git switch -c mine master <b>&lt;1&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:321021$ 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>
Junio C Hamanoc9f11c22019-07-10 02:54:041024$ git switch master <b>&lt;5&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:321025$ 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>
1034<p>
1035checkout a new branch <code>mine</code> from master.
1036</p>
1037</li>
1038<li>
1039<p>
1040repeat as needed.
1041</p>
1042</li>
1043<li>
1044<p>
1045extract patches from your branch, relative to master,
1046</p>
1047</li>
1048<li>
1049<p>
1050and email them.
1051</p>
1052</li>
1053<li>
1054<p>
1055return to <code>master</code>, ready to see what&#8217;s new
1056</p>
1057</li>
1058<li>
1059<p>
1060<code>git pull</code> fetches from <code>origin</code> by default and merges into the
1061current branch.
1062</p>
1063</li>
1064<li>
1065<p>
1066immediately after pulling, look at the changes done upstream
1067since last time we checked, only in the
1068area we are interested in.
1069</p>
1070</li>
1071<li>
1072<p>
1073check the branch names in an external repository (if not known).
1074</p>
1075</li>
1076<li>
1077<p>
1078fetch from a specific branch <code>ALL</code> from a specific repository
1079and merge it.
1080</p>
1081</li>
1082<li>
1083<p>
1084revert the pull.
1085</p>
1086</li>
1087<li>
1088<p>
1089garbage collect leftover objects from reverted pull.
1090</p>
1091</li>
1092</ol></div>
1093</dd>
1094<dt class="hdlist1">
1095Push 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>
1101satellite$ cd frotz
1102satellite$ git config --get-regexp '^(remote|branch)\.' <b>&lt;2&gt;</b>
1103remote.origin.url mothership:frotz
1104remote.origin.fetch refs/heads/*:refs/remotes/origin/*
1105branch.master.remote origin
1106branch.master.merge refs/heads/master
1107satellite$ git config remote.origin.push \
1108 +refs/heads/*:refs/remotes/satellite/* <b>&lt;3&gt;</b>
1109satellite$ edit/compile/test/commit
1110satellite$ git push origin <b>&lt;4&gt;</b>
1111
1112mothership$ cd frotz
Junio C Hamanoc9f11c22019-07-10 02:54:041113mothership$ git switch master
Junio C Hamano446e30b2014-10-16 21:30:321114mothership$ git merge satellite/master <b>&lt;5&gt;</b></code></pre>
1115</div></div>
1116<div class="colist arabic"><ol>
1117<li>
1118<p>
1119mothership machine has a frotz repository under your home
1120directory; clone from it to start a repository on the satellite
1121machine.
1122</p>
1123</li>
1124<li>
1125<p>
1126clone sets these configuration variables by default.
1127It arranges <code>git pull</code> to fetch and store the branches of mothership
1128machine to local <code>remotes/origin/*</code> remote-tracking branches.
1129</p>
1130</li>
1131<li>
1132<p>
1133arrange <code>git push</code> to push all local branches to
1134their corresponding branch of the mothership machine.
1135</p>
1136</li>
1137<li>
1138<p>
1139push will stash all our work away on <code>remotes/satellite/*</code>
1140remote-tracking branches on the mothership machine. You could use this
1141as 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>
1146<p>
1147on mothership machine, merge the work done on the satellite
1148machine into the master branch.
1149</p>
1150</li>
1151</ol></div>
1152</dd>
1153<dt class="hdlist1">
1154Branch off of a specific tag.
1155</dt>
1156<dd>
1157<div class="listingblock">
1158<div class="content">
Junio C Hamanoc9f11c22019-07-10 02:54:041159<pre><code>$ git switch -c private2.6.14 v2.6.14 <b>&lt;1&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:321160$ 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>
1166<p>
1167create a private branch based on a well known (but somewhat behind)
1168tag.
1169</p>
1170</li>
1171<li>
1172<p>
1173forward port all changes in <code>private2.6.14</code> branch to <code>master</code> branch
1174without 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
1184GitHub (www.github.com) to notify your upstream of your
1185contribution.</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
1193project receives changes made by others, reviews and integrates
1194them and publishes the result for others to use, using these
1195commands 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
1197request-pull</code> or pull-request on GitHub (www.github.com) to
Junio C Hamanoea1ac8d2018-07-18 20:16:481198integrate the work of others into their history. A sub-area
Junio C Hamano446e30b2014-10-16 21:30:321199lieutenant for a repository will act both as a participant and
1200as an integrator.</p></div>
1201<div class="ulist"><ul>
1202<li>
1203<p>
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>
1209<p>
1210<a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants.
1211</p>
1212</li>
1213<li>
1214<p>
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>
1220<p>
1221<a href="git-revert.html">git-revert(1)</a> to undo botched commits.
1222</p>
1223</li>
1224<li>
1225<p>
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">
1234A 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
Junio C Hamanoc9f11c22019-07-10 02:54:041245$ git switch -c topic/one master
Junio C Hamano446e30b2014-10-16 21:30:321246$ git am -3 -i -s ./+to-apply <b>&lt;4&gt;</b>
1247$ compile/test
Junio C Hamanoc9f11c22019-07-10 02:54:041248$ 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>
Junio C Hamanoa8911782020-07-07 05:35:571250$ git switch -C seen next <b>&lt;7&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:321251$ git merge topic/one topic/two &amp;&amp; git merge hold/linus <b>&lt;8&gt;</b>
Junio C Hamanoc9f11c22019-07-10 02:54:041252$ git switch maint
Junio C Hamano446e30b2014-10-16 21:30:321253$ 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>
Junio C Hamanoa8911782020-07-07 05:35:571256$ git fetch ko &amp;&amp; for branch in master maint next seen <b>&lt;11&gt;</b>
Junio C Hamano446e30b2014-10-16 21:30:321257 do
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>
1264<p>
1265see what you were in the middle of doing, if anything.
1266</p>
1267</li>
1268<li>
1269<p>
1270see which branches haven&#8217;t been merged into <code>master</code> yet.
1271Likewise for any other integration branches e.g. <code>maint</code>, <code>next</code>
Junio C Hamanoa8911782020-07-07 05:35:571272and <code>seen</code>.
Junio C Hamano446e30b2014-10-16 21:30:321273</p>
1274</li>
1275<li>
1276<p>
1277read mails, save ones that are applicable, and save others
1278that are not quite ready (other mail readers are available).
1279</p>
1280</li>
1281<li>
1282<p>
1283apply them, interactively, with your sign-offs.
1284</p>
1285</li>
1286<li>
1287<p>
1288create topic branch as needed and apply, again with sign-offs.
1289</p>
1290</li>
1291<li>
1292<p>
1293rebase internal topic branch that has not been merged to the
1294master or exposed as a part of a stable branch.
1295</p>
1296</li>
1297<li>
1298<p>
Junio C Hamanoa8911782020-07-07 05:35:571299restart <code>seen</code> every time from the next.
Junio C Hamano446e30b2014-10-16 21:30:321300</p>
1301</li>
1302<li>
1303<p>
1304and bundle topic branches still cooking.
1305</p>
1306</li>
1307<li>
1308<p>
1309backport a critical fix.
1310</p>
1311</li>
1312<li>
1313<p>
1314create a signed tag.
1315</p>
1316</li>
1317<li>
1318<p>
1319make sure master was not accidentally rewound beyond that
Junio C Hamanodda5d0f2017-01-19 23:33:311320already pushed out.
Junio C Hamano446e30b2014-10-16 21:30:321321</p>
Junio C Hamano446e30b2014-10-16 21:30:321322</li>
1323<li>
1324<p>
1325In the output from <code>git show-branch</code>, <code>master</code> should have
1326everything <code>ko/master</code> has, and <code>next</code> should have
1327everything <code>ko/next</code> has, etc.
1328</p>
1329</li>
1330<li>
1331<p>
1332push out the bleeding edge, together with new tags that point
1333into the pushed history.
1334</p>
1335</li>
1336</ol></div>
1337</dd>
1338</dl></div>
Junio C Hamanodda5d0f2017-01-19 23:33:311339<div class="paragraph"><p>In this example, the <code>ko</code> shorthand points at the Git maintainer&#8217;s
1340repository 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
Junio C Hamanoa8911782020-07-07 05:35:571349 push = +refs/heads/seen
Junio C Hamanodda5d0f2017-01-19 23:33:311350 push = refs/heads/maint</code></pre>
1351</div></div>
Junio C Hamano446e30b2014-10-16 21:30:321352</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
1359and maintain access to the repository by developers.</p></div>
1360<div class="ulist"><ul>
1361<li>
1362<p>
1363<a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from
1364 repository.
1365</p>
1366</li>
1367<li>
1368<p>
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>
1374<p>
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>
1380<p>
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
1387example 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
1389and reviewing solutions such as:</p></div>
1390<div class="ulist"><ul>
1391<li>
1392<p>
1393gitolite, 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">
1401We 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
1407git 9418/tcp # Git Version Control System</code></pre>
1408</div></div>
1409</dd>
1410<dt class="hdlist1">
1411Run 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
1417git 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">
1423Run 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
1431service git
1432{
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.
1445Others might be different.</p></div>
1446</dd>
1447<dt class="hdlist1">
1448Give push/pull only access to developers using git-over-ssh.
1449</dt>
1450<dd>
1451<p>
1452e.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>
1458alice:x:1000:1000::/home/alice:/usr/bin/git-shell
1459bob:x:1001:1001::/home/bob:/usr/bin/git-shell
1460cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
1461david: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>
1467<p>
1468log-in shell is set to /usr/bin/git-shell, which does not
1469allow anything but <code>git push</code> and <code>git pull</code>. The users require
1470ssh access to the machine.
1471</p>
1472</li>
1473<li>
1474<p>
1475in many distributions /etc/shells needs to list what is used
1476as the login shell.
1477</p>
1478</li>
1479</ol></div>
1480</dd>
1481<dt class="hdlist1">
1482CVS-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>
1488git: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>
1504refs/heads/master alice\|cindy
1505refs/heads/doc-update bob
1506refs/tags/v[0-9]* david</code></pre>
1507</div></div>
1508<div class="colist arabic"><ol>
1509<li>
1510<p>
1511place the developers into the same git group.
1512</p>
1513</li>
1514<li>
1515<p>
1516and make the shared repository writable by the group.
1517</p>
1518</li>
1519<li>
1520<p>
1521use update-hook example by Carl from Documentation/howto/
1522for branch policy control.
1523</p>
1524</li>
1525<li>
1526<p>
1527alice and cindy can push into master, only bob can push into doc-update.
1528david is the release manager and is the only person who can
1529create 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">
Junio C Hamano2ef0ba32018-01-26 23:13:531548Last updated
Junio C Hamanoa8911782020-07-07 05:35:571549 2020-07-06 22:33:22 PDT
Junio C Hamano446e30b2014-10-16 21:30:321550</div>
1551</div>
1552</body>
1553</html>