blob: eae3b461ebb102287fccb559ae1090cab70f1a55 [file] [log] [blame]
Junio C Hamano446e30b2014-10-16 21:30:321<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6<meta name="generator" content="AsciiDoc 8.6.9" />
7<title>giteveryday(7)</title>
8<style type="text/css">
9/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
24}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
30a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
37
38em {
39 font-style: italic;
40 color: navy;
41}
42
43strong {
44 font-weight: bold;
45 color: #083194;
46}
47
48h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
50 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
55h1, h2, h3 {
56 border-bottom: 2px solid silver;
57}
58h2 {
59 padding-top: 0.5em;
60}
61h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
67h5 {
68 font-size: 1.0em;
69}
70
71div.sectionbody {
72 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
84ul, ol, li > p {
85 margin-top: 0;
86}
87ul > li { color: #aaa; }
88ul > li > * { color: black; }
89
90.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
94 padding: 0;
95 margin: 0;
96}
97pre {
98 white-space: pre-wrap;
99}
100
101#author {
102 color: #527bbd;
103 font-weight: bold;
104 font-size: 1.1em;
105}
106#email {
107}
108#revnumber, #revdate, #revremark {
109}
110
111#footer {
112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
117#footer-text {
118 float: left;
119 padding-bottom: 0.5em;
120}
121#footer-badges {
122 float: right;
123 padding-bottom: 0.5em;
124}
125
126#preamble {
127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
130div.imageblock, div.exampleblock, div.verseblock,
131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
133 margin-top: 1.0em;
134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
149 color: #527bbd;
150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
180 padding: 0.5em;
181}
182
183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
186 margin-right: 10%;
187 border-left: 5px solid #f0f0f0;
188 color: #888;
189}
190
191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
193 text-align: right;
194}
195
196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
205div.verseblock + div.attribution {
206 text-align: left;
207}
208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
219 border-left: 3px solid #dddddd;
220}
221
222div.exampleblock > div.content {
223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
225}
226
227div.imageblock div.content { padding-left: 0; }
228span.image img { border-style: none; vertical-align: text-bottom; }
229a.image:visited { color: white; }
230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
238 font-style: normal;
239 color: navy;
240}
241dd > *:first-child {
242 margin-top: 0.1em;
243}
244
245ul, ol {
246 list-style-position: outside;
247}
248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
252 list-style-type: lower-alpha;
253}
254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
270
271tfoot {
272 font-weight: bold;
273}
274td > div.verse {
275 white-space: pre;
276}
277
278div.hdlist {
279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
282div.hdlist tr {
283 padding-bottom: 15px;
284}
285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
289 vertical-align: top;
290 font-style: normal;
291 padding-right: 0.8em;
292 color: navy;
293}
294td.hdlist2 {
295 vertical-align: top;
296}
297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
305
306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
340}
341
342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
347 margin-bottom: 2.5em;
348}
349
350#toctitle {
351 color: #527bbd;
352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
416div.unbreakable { page-break-inside: avoid; }
417
418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
526body.manpage h2 {
527 border-style: none;
528}
529body.manpage div.sectionbody {
530 margin-left: 3em;
531}
532
533@media print {
534 body.manpage div#toc { display: none; }
535}
536
537
538</style>
539<script type="text/javascript">
540/*<![CDATA[*/
541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
611 if (entry.nodeName.toLowerCase() == 'div'
612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
650 var noteholder = document.getElementById("footnotes");
651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
727}
728
729}
730asciidoc.install();
731/*]]>*/
732</script>
733</head>
734<body class="manpage">
735<div id="header">
736<h1>
737giteveryday(7) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>giteveryday -
742 A useful minimum set of commands for Everyday Git
743</p>
744</div>
745</div>
746<div id="content">
747<div class="sect1">
748<h2 id="_synopsis">SYNOPSIS</h2>
749<div class="sectionbody">
750<div class="paragraph"><p>Everyday Git With 20 Commands Or So</p></div>
751</div>
752</div>
753<div class="sect1">
754<h2 id="_description">DESCRIPTION</h2>
755<div class="sectionbody">
756<div class="paragraph"><p>Git users can broadly be grouped into four categories for the purposes of
757describing here a small set of useful command for everyday Git.</p></div>
758<div class="ulist"><ul>
759<li>
760<p>
761<a href="#STANDALONE">Individual Developer (Standalone)</a> commands are essential
762 for anybody who makes a commit, even for somebody who works alone.
763</p>
764</li>
765<li>
766<p>
767If you work with other people, you will need commands listed in
768 the <a href="#PARTICIPANT">Individual Developer (Participant)</a> section as well.
769</p>
770</li>
771<li>
772<p>
773People who play the <a href="#INTEGRATOR">Integrator</a> role need to learn some
774 more commands in addition to the above.
775</p>
776</li>
777<li>
778<p>
779<a href="#ADMINISTRATION">Repository Administration</a> commands are for system
780 administrators who are responsible for the care and feeding
781 of Git repositories.
782</p>
783</li>
784</ul></div>
785</div>
786</div>
787<div class="sect1">
788<h2 id="_individual_developer_standalone_a_id_standalone_a">Individual Developer (Standalone)<a id="STANDALONE"></a></h2>
789<div class="sectionbody">
790<div class="paragraph"><p>A standalone individual developer does not exchange patches with
791other people, and works alone in a single repository, using the
792following commands.</p></div>
793<div class="ulist"><ul>
794<li>
795<p>
796<a href="git-init.html">git-init(1)</a> to create a new repository.
797</p>
798</li>
799<li>
800<p>
801<a href="git-log.html">git-log(1)</a> to see what happened.
802</p>
803</li>
804<li>
805<p>
806<a href="git-checkout.html">git-checkout(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch
807 branches.
808</p>
809</li>
810<li>
811<p>
812<a href="git-add.html">git-add(1)</a> to manage the index file.
813</p>
814</li>
815<li>
816<p>
817<a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what
818 you are in the middle of doing.
819</p>
820</li>
821<li>
822<p>
823<a href="git-commit.html">git-commit(1)</a> to advance the current branch.
824</p>
825</li>
826<li>
827<p>
828<a href="git-reset.html">git-reset(1)</a> and <a href="git-checkout.html">git-checkout(1)</a> (with
829 pathname parameters) to undo changes.
830</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">
883<pre><code>$ git checkout -b alsa-audio <b>&lt;1&gt;</b>
884$ edit/compile/test
885$ git checkout -- 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 checkout 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>
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
1020$ git checkout -b 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 checkout 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>
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
1113mothership$ git checkout master
1114mothership$ 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">
1159<pre><code>$ git checkout -b 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>
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
1198integrate the work of others into their history. An sub-area
1199lieutenant 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
1245$ git checkout -b topic/one master
1246$ git am -3 -i -s ./+to-apply <b>&lt;4&gt;</b>
1247$ compile/test
1248$ git checkout -b hold/linus &amp;&amp; git am -3 -i -s ./+hold-linus <b>&lt;5&gt;</b>
1249$ git checkout topic/one &amp;&amp; git rebase master <b>&lt;6&gt;</b>
1250$ git checkout pu &amp;&amp; git reset --hard 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 checkout 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 pu <b>&lt;11&gt;</b>
1257 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>
1272and <code>pu</code> (potential updates).
1273</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>
1299restart <code>pu</code> every time from the next.
1300</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
1320already pushed out. <code>ko</code> shorthand points at the Git maintainer&#8217;s
1321repository at kernel.org, and looks like this:
1322</p>
1323<div class="listingblock">
1324<div class="content">
1325<pre><code>(in .git/config)
1326[remote "ko"]
1327 url = kernel.org:/pub/scm/git/git.git
1328 fetch = refs/heads/*:refs/remotes/ko/*
1329 push = refs/heads/master
1330 push = refs/heads/next
1331 push = +refs/heads/pu
1332 push = refs/heads/maint</code></pre>
1333</div></div>
1334</li>
1335<li>
1336<p>
1337In the output from <code>git show-branch</code>, <code>master</code> should have
1338everything <code>ko/master</code> has, and <code>next</code> should have
1339everything <code>ko/next</code> has, etc.
1340</p>
1341</li>
1342<li>
1343<p>
1344push out the bleeding edge, together with new tags that point
1345into the pushed history.
1346</p>
1347</li>
1348</ol></div>
1349</dd>
1350</dl></div>
1351</div>
1352</div>
1353</div>
1354<div class="sect1">
1355<h2 id="_repository_administration_a_id_administration_a">Repository Administration<a id="ADMINISTRATION"></a></h2>
1356<div class="sectionbody">
1357<div class="paragraph"><p>A repository administrator uses the following tools to set up
1358and maintain access to the repository by developers.</p></div>
1359<div class="ulist"><ul>
1360<li>
1361<p>
1362<a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from
1363 repository.
1364</p>
1365</li>
1366<li>
1367<p>
1368<a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em>
1369 for shared central repository users.
1370</p>
1371</li>
1372<li>
1373<p>
1374<a href="git-http-backend.html">git-http-backend(1)</a> provides a server side implementation
1375 of Git-over-HTTP ("Smart http") allowing both fetch and push services.
1376</p>
1377</li>
1378<li>
1379<p>
1380<a href="gitweb.html">gitweb(1)</a> provides a web front-end to Git repositories,
1381 which can be set-up using the <a href="git-instaweb.html">git-instaweb(1)</a> script.
1382</p>
1383</li>
1384</ul></div>
1385<div class="paragraph"><p><a href="howto/update-hook-example.html">update hook howto</a> has a good
1386example of managing a shared central repository.</p></div>
1387<div class="paragraph"><p>In addition there are a number of other widely deployed hosting, browsing
1388and reviewing solutions such as:</p></div>
1389<div class="ulist"><ul>
1390<li>
1391<p>
1392gitolite, gerrit code review, cgit and others.
1393</p>
1394</li>
1395</ul></div>
1396<div class="sect2">
1397<h3 id="_examples_4">Examples</h3>
1398<div class="dlist"><dl>
1399<dt class="hdlist1">
1400We assume the following in /etc/services
1401</dt>
1402<dd>
1403<div class="listingblock">
1404<div class="content">
1405<pre><code>$ grep 9418 /etc/services
1406git 9418/tcp # Git Version Control System</code></pre>
1407</div></div>
1408</dd>
1409<dt class="hdlist1">
1410Run git-daemon to serve /pub/scm from inetd.
1411</dt>
1412<dd>
1413<div class="listingblock">
1414<div class="content">
1415<pre><code>$ grep git /etc/inetd.conf
1416git stream tcp nowait nobody \
1417 /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</code></pre>
1418</div></div>
1419<div class="paragraph"><p>The actual configuration line should be on one line.</p></div>
1420</dd>
1421<dt class="hdlist1">
1422Run git-daemon to serve /pub/scm from xinetd.
1423</dt>
1424<dd>
1425<div class="listingblock">
1426<div class="content">
1427<pre><code>$ cat /etc/xinetd.d/git-daemon
1428# default: off
1429# description: The Git server offers access to Git repositories
1430service git
1431{
1432 disable = no
1433 type = UNLISTED
1434 port = 9418
1435 socket_type = stream
1436 wait = no
1437 user = nobody
1438 server = /usr/bin/git-daemon
1439 server_args = --inetd --export-all --base-path=/pub/scm
1440 log_on_failure += USERID
1441}</code></pre>
1442</div></div>
1443<div class="paragraph"><p>Check your xinetd(8) documentation and setup, this is from a Fedora system.
1444Others might be different.</p></div>
1445</dd>
1446<dt class="hdlist1">
1447Give push/pull only access to developers using git-over-ssh.
1448</dt>
1449<dd>
1450<p>
1451e.g. those using:
1452<code>$ git push/pull ssh://host.xz/pub/scm/project</code>
1453</p>
1454<div class="listingblock">
1455<div class="content">
1456<pre><code>$ grep git /etc/passwd <b>&lt;1&gt;</b>
1457alice:x:1000:1000::/home/alice:/usr/bin/git-shell
1458bob:x:1001:1001::/home/bob:/usr/bin/git-shell
1459cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
1460david:x:1003:1003::/home/david:/usr/bin/git-shell
1461$ grep git /etc/shells <b>&lt;2&gt;</b>
1462/usr/bin/git-shell</code></pre>
1463</div></div>
1464<div class="colist arabic"><ol>
1465<li>
1466<p>
1467log-in shell is set to /usr/bin/git-shell, which does not
1468allow anything but <code>git push</code> and <code>git pull</code>. The users require
1469ssh access to the machine.
1470</p>
1471</li>
1472<li>
1473<p>
1474in many distributions /etc/shells needs to list what is used
1475as the login shell.
1476</p>
1477</li>
1478</ol></div>
1479</dd>
1480<dt class="hdlist1">
1481CVS-style shared repository.
1482</dt>
1483<dd>
1484<div class="listingblock">
1485<div class="content">
1486<pre><code>$ grep git /etc/group <b>&lt;1&gt;</b>
1487git:x:9418:alice,bob,cindy,david
1488$ cd /home/devo.git
1489$ ls -l <b>&lt;2&gt;</b>
1490 lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -&gt; refs/heads/master
1491 drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches
1492 -rw-rw-r-- 1 david git 84 Dec 4 22:40 config
1493 -rw-rw-r-- 1 david git 58 Dec 4 22:40 description
1494 drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks
1495 -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index
1496 drwxrwsr-x 2 david git 4096 Dec 4 22:40 info
1497 drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects
1498 drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs
1499 drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes
1500$ ls -l hooks/update <b>&lt;3&gt;</b>
1501 -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update
1502$ cat info/allowed-users <b>&lt;4&gt;</b>
1503refs/heads/master alice\|cindy
1504refs/heads/doc-update bob
1505refs/tags/v[0-9]* david</code></pre>
1506</div></div>
1507<div class="colist arabic"><ol>
1508<li>
1509<p>
1510place the developers into the same git group.
1511</p>
1512</li>
1513<li>
1514<p>
1515and make the shared repository writable by the group.
1516</p>
1517</li>
1518<li>
1519<p>
1520use update-hook example by Carl from Documentation/howto/
1521for branch policy control.
1522</p>
1523</li>
1524<li>
1525<p>
1526alice and cindy can push into master, only bob can push into doc-update.
1527david is the release manager and is the only person who can
1528create and push version tags.
1529</p>
1530</li>
1531</ol></div>
1532</dd>
1533</dl></div>
1534</div>
1535</div>
1536</div>
1537<div class="sect1">
1538<h2 id="_git">GIT</h2>
1539<div class="sectionbody">
1540<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1541</div>
1542</div>
1543</div>
1544<div id="footnotes"><hr /></div>
1545<div id="footer">
1546<div id="footer-text">
Junio C Hamanod30e7ef2015-12-10 22:27:171547Last updated 2015-10-29 14:44:28 PDT
Junio C Hamano446e30b2014-10-16 21:30:321548</div>
1549</div>
1550</body>
1551</html>