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