Autogenerated HTML docs for v1.7.6-rc1
[git/jnareb-git.git] / everyday.html
blobb6283670dbe7607273996667531c33441ab0db99
1 <!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="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>Everyday GIT With 20 Commands Or So</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Workarounds for IE6's broken and incomplete CSS2. */
344 div.sidebar-content {
345 background: #ffffee;
346 border: 1px solid silver;
347 padding: 0.5em;
349 div.sidebar-title, div.image-title {
350 color: #527bbd;
351 font-family: sans-serif;
352 font-weight: bold;
353 margin-top: 0.0em;
354 margin-bottom: 0.5em;
357 div.listingblock div.content {
358 border: 1px solid silver;
359 background: #f4f4f4;
360 padding: 0.5em;
363 div.quoteblock-attribution {
364 padding-top: 0.5em;
365 text-align: right;
368 div.verseblock-content {
369 white-space: pre;
371 div.verseblock-attribution {
372 padding-top: 0.75em;
373 text-align: left;
376 div.exampleblock-content {
377 border-left: 2px solid silver;
378 padding-left: 0.5em;
381 /* IE6 sets dynamically generated links as visited. */
382 div#toc a:visited { color: blue; }
383 </style>
384 </head>
385 <body>
386 <div id="header">
387 <h1>Everyday GIT With 20 Commands Or So</h1>
388 </div>
389 <div id="preamble">
390 <div class="sectionbody">
391 <div class="paragraph"><p><a href="#Individual Developer (Standalone)">[Individual Developer (Standalone)]</a> commands are essential for
392 anybody who makes a commit, even for somebody who works alone.</p></div>
393 <div class="paragraph"><p>If you work with other people, you will need commands listed in
394 the <a href="#Individual Developer (Participant)">[Individual Developer (Participant)]</a> section as well.</p></div>
395 <div class="paragraph"><p>People who play the <a href="#Integrator">[Integrator]</a> role need to learn some more
396 commands in addition to the above.</p></div>
397 <div class="paragraph"><p><a href="#Repository Administration">[Repository Administration]</a> commands are for system
398 administrators who are responsible for the care and feeding
399 of git repositories.</p></div>
400 </div>
401 </div>
402 <h2 id="_individual_developer_standalone_a_id_individual_developer_standalone_a">Individual Developer (Standalone)<a id="Individual Developer (Standalone)"></a></h2>
403 <div class="sectionbody">
404 <div class="paragraph"><p>A standalone individual developer does not exchange patches with
405 other people, and works alone in a single repository, using the
406 following commands.</p></div>
407 <div class="ulist"><ul>
408 <li>
410 <a href="git-init.html">git-init(1)</a> to create a new repository.
411 </p>
412 </li>
413 <li>
415 <a href="git-show-branch.html">git-show-branch(1)</a> to see where you are.
416 </p>
417 </li>
418 <li>
420 <a href="git-log.html">git-log(1)</a> to see what happened.
421 </p>
422 </li>
423 <li>
425 <a href="git-checkout.html">git-checkout(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch
426 branches.
427 </p>
428 </li>
429 <li>
431 <a href="git-add.html">git-add(1)</a> to manage the index file.
432 </p>
433 </li>
434 <li>
436 <a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what
437 you are in the middle of doing.
438 </p>
439 </li>
440 <li>
442 <a href="git-commit.html">git-commit(1)</a> to advance the current branch.
443 </p>
444 </li>
445 <li>
447 <a href="git-reset.html">git-reset(1)</a> and <a href="git-checkout.html">git-checkout(1)</a> (with
448 pathname parameters) to undo changes.
449 </p>
450 </li>
451 <li>
453 <a href="git-merge.html">git-merge(1)</a> to merge between local branches.
454 </p>
455 </li>
456 <li>
458 <a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches.
459 </p>
460 </li>
461 <li>
463 <a href="git-tag.html">git-tag(1)</a> to mark known point.
464 </p>
465 </li>
466 </ul></div>
467 <h3 id="_examples">Examples</h3><div style="clear:left"></div>
468 <div class="dlist"><dl>
469 <dt class="hdlist1">
470 Use a tarball as a starting point for a new repository.
471 </dt>
472 <dd>
473 <div class="listingblock">
474 <div class="content">
475 <pre><tt>$ tar zxf frotz.tar.gz
476 $ cd frotz
477 $ git init
478 $ git add . <b>&lt;1&gt;</b>
479 $ git commit -m "import of frotz source tree."
480 $ git tag v2.43 <b>&lt;2&gt;</b></tt></pre>
481 </div></div>
482 <div class="colist arabic"><ol>
483 <li>
485 add everything under the current directory.
486 </p>
487 </li>
488 <li>
490 make a lightweight, unannotated tag.
491 </p>
492 </li>
493 </ol></div>
494 </dd>
495 <dt class="hdlist1">
496 Create a topic branch and develop.
497 </dt>
498 <dd>
499 <div class="listingblock">
500 <div class="content">
501 <pre><tt>$ git checkout -b alsa-audio <b>&lt;1&gt;</b>
502 $ edit/compile/test
503 $ git checkout -- curses/ux_audio_oss.c <b>&lt;2&gt;</b>
504 $ git add curses/ux_audio_alsa.c <b>&lt;3&gt;</b>
505 $ edit/compile/test
506 $ git diff HEAD <b>&lt;4&gt;</b>
507 $ git commit -a -s <b>&lt;5&gt;</b>
508 $ edit/compile/test
509 $ git reset --soft HEAD^ <b>&lt;6&gt;</b>
510 $ edit/compile/test
511 $ git diff ORIG_HEAD <b>&lt;7&gt;</b>
512 $ git commit -a -c ORIG_HEAD <b>&lt;8&gt;</b>
513 $ git checkout master <b>&lt;9&gt;</b>
514 $ git merge alsa-audio <b>&lt;10&gt;</b>
515 $ git log --since='3 days ago' <b>&lt;11&gt;</b>
516 $ git log v2.43.. curses/ <b>&lt;12&gt;</b></tt></pre>
517 </div></div>
518 <div class="colist arabic"><ol>
519 <li>
521 create a new topic branch.
522 </p>
523 </li>
524 <li>
526 revert your botched changes in <tt>curses/ux_audio_oss.c</tt>.
527 </p>
528 </li>
529 <li>
531 you need to tell git if you added a new file; removal and
532 modification will be caught if you do <tt>git commit -a</tt> later.
533 </p>
534 </li>
535 <li>
537 to see what changes you are committing.
538 </p>
539 </li>
540 <li>
542 commit everything as you have tested, with your sign-off.
543 </p>
544 </li>
545 <li>
547 take the last commit back, keeping what is in the working tree.
548 </p>
549 </li>
550 <li>
552 look at the changes since the premature commit we took back.
553 </p>
554 </li>
555 <li>
557 redo the commit undone in the previous step, using the message
558 you originally wrote.
559 </p>
560 </li>
561 <li>
563 switch to the master branch.
564 </p>
565 </li>
566 <li>
568 merge a topic branch into your master branch.
569 </p>
570 </li>
571 <li>
573 review commit logs; other forms to limit output can be
574 combined and include <tt>--max-count=10</tt> (show 10 commits),
575 <tt>--until=2005-12-10</tt>, etc.
576 </p>
577 </li>
578 <li>
580 view only the changes that touch what&#8217;s in <tt>curses/</tt>
581 directory, since <tt>v2.43</tt> tag.
582 </p>
583 </li>
584 </ol></div>
585 </dd>
586 </dl></div>
587 </div>
588 <h2 id="_individual_developer_participant_a_id_individual_developer_participant_a">Individual Developer (Participant)<a id="Individual Developer (Participant)"></a></h2>
589 <div class="sectionbody">
590 <div class="paragraph"><p>A developer working as a participant in a group project needs to
591 learn how to communicate with others, and uses these commands in
592 addition to the ones needed by a standalone developer.</p></div>
593 <div class="ulist"><ul>
594 <li>
596 <a href="git-clone.html">git-clone(1)</a> from the upstream to prime your local
597 repository.
598 </p>
599 </li>
600 <li>
602 <a href="git-pull.html">git-pull(1)</a> and <a href="git-fetch.html">git-fetch(1)</a> from "origin"
603 to keep up-to-date with the upstream.
604 </p>
605 </li>
606 <li>
608 <a href="git-push.html">git-push(1)</a> to shared repository, if you adopt CVS
609 style shared repository workflow.
610 </p>
611 </li>
612 <li>
614 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare e-mail submission, if
615 you adopt Linux kernel-style public forum workflow.
616 </p>
617 </li>
618 </ul></div>
619 <h3 id="_examples_2">Examples</h3><div style="clear:left"></div>
620 <div class="dlist"><dl>
621 <dt class="hdlist1">
622 Clone the upstream and work on it. Feed changes to upstream.
623 </dt>
624 <dd>
625 <div class="listingblock">
626 <div class="content">
627 <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
628 $ cd my2.6
629 $ edit/compile/test; git commit -a -s <b>&lt;1&gt;</b>
630 $ git format-patch origin <b>&lt;2&gt;</b>
631 $ git pull <b>&lt;3&gt;</b>
632 $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <b>&lt;4&gt;</b>
633 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <b>&lt;5&gt;</b>
634 $ git reset --hard ORIG_HEAD <b>&lt;6&gt;</b>
635 $ git gc <b>&lt;7&gt;</b>
636 $ git fetch --tags <b>&lt;8&gt;</b></tt></pre>
637 </div></div>
638 <div class="colist arabic"><ol>
639 <li>
641 repeat as needed.
642 </p>
643 </li>
644 <li>
646 extract patches from your branch for e-mail submission.
647 </p>
648 </li>
649 <li>
651 <tt>git pull</tt> fetches from <tt>origin</tt> by default and merges into the
652 current branch.
653 </p>
654 </li>
655 <li>
657 immediately after pulling, look at the changes done upstream
658 since last time we checked, only in the
659 area we are interested in.
660 </p>
661 </li>
662 <li>
664 fetch from a specific branch from a specific repository and merge.
665 </p>
666 </li>
667 <li>
669 revert the pull.
670 </p>
671 </li>
672 <li>
674 garbage collect leftover objects from reverted pull.
675 </p>
676 </li>
677 <li>
679 from time to time, obtain official tags from the <tt>origin</tt>
680 and store them under <tt>.git/refs/tags/</tt>.
681 </p>
682 </li>
683 </ol></div>
684 </dd>
685 <dt class="hdlist1">
686 Push into another repository.
687 </dt>
688 <dd>
689 <div class="listingblock">
690 <div class="content">
691 <pre><tt>satellite$ git clone mothership:frotz frotz <b>&lt;1&gt;</b>
692 satellite$ cd frotz
693 satellite$ git config --get-regexp '^(remote|branch)\.' <b>&lt;2&gt;</b>
694 remote.origin.url mothership:frotz
695 remote.origin.fetch refs/heads/*:refs/remotes/origin/*
696 branch.master.remote origin
697 branch.master.merge refs/heads/master
698 satellite$ git config remote.origin.push \
699 master:refs/remotes/satellite/master <b>&lt;3&gt;</b>
700 satellite$ edit/compile/test/commit
701 satellite$ git push origin <b>&lt;4&gt;</b>
703 mothership$ cd frotz
704 mothership$ git checkout master
705 mothership$ git merge satellite/master <b>&lt;5&gt;</b></tt></pre>
706 </div></div>
707 <div class="colist arabic"><ol>
708 <li>
710 mothership machine has a frotz repository under your home
711 directory; clone from it to start a repository on the satellite
712 machine.
713 </p>
714 </li>
715 <li>
717 clone sets these configuration variables by default.
718 It arranges <tt>git pull</tt> to fetch and store the branches of mothership
719 machine to local <tt>remotes/origin/*</tt> remote-tracking branches.
720 </p>
721 </li>
722 <li>
724 arrange <tt>git push</tt> to push local <tt>master</tt> branch to
725 <tt>remotes/satellite/master</tt> branch of the mothership machine.
726 </p>
727 </li>
728 <li>
730 push will stash our work away on <tt>remotes/satellite/master</tt>
731 remote-tracking branch on the mothership machine. You could use this
732 as a back-up method.
733 </p>
734 </li>
735 <li>
737 on mothership machine, merge the work done on the satellite
738 machine into the master branch.
739 </p>
740 </li>
741 </ol></div>
742 </dd>
743 <dt class="hdlist1">
744 Branch off of a specific tag.
745 </dt>
746 <dd>
747 <div class="listingblock">
748 <div class="content">
749 <pre><tt>$ git checkout -b private2.6.14 v2.6.14 <b>&lt;1&gt;</b>
750 $ edit/compile/test; git commit -a
751 $ git checkout master
752 $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
753 git am -3 -k <b>&lt;2&gt;</b></tt></pre>
754 </div></div>
755 <div class="colist arabic"><ol>
756 <li>
758 create a private branch based on a well known (but somewhat behind)
759 tag.
760 </p>
761 </li>
762 <li>
764 forward port all changes in <tt>private2.6.14</tt> branch to <tt>master</tt> branch
765 without a formal "merging".
766 </p>
767 </li>
768 </ol></div>
769 </dd>
770 </dl></div>
771 </div>
772 <h2 id="_integrator_a_id_integrator_a">Integrator<a id="Integrator"></a></h2>
773 <div class="sectionbody">
774 <div class="paragraph"><p>A fairly central person acting as the integrator in a group
775 project receives changes made by others, reviews and integrates
776 them and publishes the result for others to use, using these
777 commands in addition to the ones needed by participants.</p></div>
778 <div class="ulist"><ul>
779 <li>
781 <a href="git-am.html">git-am(1)</a> to apply patches e-mailed in from your
782 contributors.
783 </p>
784 </li>
785 <li>
787 <a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants.
788 </p>
789 </li>
790 <li>
792 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare and send suggested
793 alternative to contributors.
794 </p>
795 </li>
796 <li>
798 <a href="git-revert.html">git-revert(1)</a> to undo botched commits.
799 </p>
800 </li>
801 <li>
803 <a href="git-push.html">git-push(1)</a> to publish the bleeding edge.
804 </p>
805 </li>
806 </ul></div>
807 <h3 id="_examples_3">Examples</h3><div style="clear:left"></div>
808 <div class="dlist"><dl>
809 <dt class="hdlist1">
810 My typical GIT day.
811 </dt>
812 <dd>
813 <div class="listingblock">
814 <div class="content">
815 <pre><tt>$ git status <b>&lt;1&gt;</b>
816 $ git show-branch <b>&lt;2&gt;</b>
817 $ mailx <b>&lt;3&gt;</b>
818 &amp; s 2 3 4 5 ./+to-apply
819 &amp; s 7 8 ./+hold-linus
820 &amp; q
821 $ git checkout -b topic/one master
822 $ git am -3 -i -s -u ./+to-apply <b>&lt;4&gt;</b>
823 $ compile/test
824 $ git checkout -b hold/linus &amp;&amp; git am -3 -i -s -u ./+hold-linus <b>&lt;5&gt;</b>
825 $ git checkout topic/one &amp;&amp; git rebase master <b>&lt;6&gt;</b>
826 $ git checkout pu &amp;&amp; git reset --hard next <b>&lt;7&gt;</b>
827 $ git merge topic/one topic/two &amp;&amp; git merge hold/linus <b>&lt;8&gt;</b>
828 $ git checkout maint
829 $ git cherry-pick master~4 <b>&lt;9&gt;</b>
830 $ compile/test
831 $ git tag -s -m "GIT 0.99.9x" v0.99.9x <b>&lt;10&gt;</b>
832 $ git fetch ko &amp;&amp; git show-branch master maint 'tags/ko-*' <b>&lt;11&gt;</b>
833 $ git push ko <b>&lt;12&gt;</b>
834 $ git push ko v0.99.9x <b>&lt;13&gt;</b></tt></pre>
835 </div></div>
836 <div class="colist arabic"><ol>
837 <li>
839 see what I was in the middle of doing, if any.
840 </p>
841 </li>
842 <li>
844 see what topic branches I have and think about how ready
845 they are.
846 </p>
847 </li>
848 <li>
850 read mails, save ones that are applicable, and save others
851 that are not quite ready.
852 </p>
853 </li>
854 <li>
856 apply them, interactively, with my sign-offs.
857 </p>
858 </li>
859 <li>
861 create topic branch as needed and apply, again with my
862 sign-offs.
863 </p>
864 </li>
865 <li>
867 rebase internal topic branch that has not been merged to the
868 master, nor exposed as a part of a stable branch.
869 </p>
870 </li>
871 <li>
873 restart <tt>pu</tt> every time from the next.
874 </p>
875 </li>
876 <li>
878 and bundle topic branches still cooking.
879 </p>
880 </li>
881 <li>
883 backport a critical fix.
884 </p>
885 </li>
886 <li>
888 create a signed tag.
889 </p>
890 </li>
891 <li>
893 make sure I did not accidentally rewind master beyond what I
894 already pushed out. <tt>ko</tt> shorthand points at the repository I have
895 at kernel.org, and looks like this:
896 </p>
897 <div class="listingblock">
898 <div class="content">
899 <pre><tt>$ cat .git/remotes/ko
900 URL: kernel.org:/pub/scm/git/git.git
901 Pull: master:refs/tags/ko-master
902 Pull: next:refs/tags/ko-next
903 Pull: maint:refs/tags/ko-maint
904 Push: master
905 Push: next
906 Push: +pu
907 Push: maint</tt></pre>
908 </div></div>
909 <div class="paragraph"><p>In the output from <tt>git show-branch</tt>, <tt>master</tt> should have
910 everything <tt>ko-master</tt> has, and <tt>next</tt> should have
911 everything <tt>ko-next</tt> has.</p></div>
912 </li>
913 <li>
915 push out the bleeding edge.
916 </p>
917 </li>
918 <li>
920 push the tag out, too.
921 </p>
922 </li>
923 </ol></div>
924 </dd>
925 </dl></div>
926 </div>
927 <h2 id="_repository_administration_a_id_repository_administration_a">Repository Administration<a id="Repository Administration"></a></h2>
928 <div class="sectionbody">
929 <div class="paragraph"><p>A repository administrator uses the following tools to set up
930 and maintain access to the repository by developers.</p></div>
931 <div class="ulist"><ul>
932 <li>
934 <a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from
935 repository.
936 </p>
937 </li>
938 <li>
940 <a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em>
941 for shared central repository users.
942 </p>
943 </li>
944 </ul></div>
945 <div class="paragraph"><p><a href="howto/update-hook-example.txt">update hook howto</a> has a good
946 example of managing a shared central repository.</p></div>
947 <h3 id="_examples_4">Examples</h3><div style="clear:left"></div>
948 <div class="dlist"><dl>
949 <dt class="hdlist1">
950 We assume the following in /etc/services
951 </dt>
952 <dd>
953 <div class="listingblock">
954 <div class="content">
955 <pre><tt>$ grep 9418 /etc/services
956 git 9418/tcp # Git Version Control System</tt></pre>
957 </div></div>
958 </dd>
959 <dt class="hdlist1">
960 Run git-daemon to serve /pub/scm from inetd.
961 </dt>
962 <dd>
963 <div class="listingblock">
964 <div class="content">
965 <pre><tt>$ grep git /etc/inetd.conf
966 git stream tcp nowait nobody \
967 /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</tt></pre>
968 </div></div>
969 <div class="paragraph"><p>The actual configuration line should be on one line.</p></div>
970 </dd>
971 <dt class="hdlist1">
972 Run git-daemon to serve /pub/scm from xinetd.
973 </dt>
974 <dd>
975 <div class="listingblock">
976 <div class="content">
977 <pre><tt>$ cat /etc/xinetd.d/git-daemon
978 # default: off
979 # description: The git server offers access to git repositories
980 service git
982 disable = no
983 type = UNLISTED
984 port = 9418
985 socket_type = stream
986 wait = no
987 user = nobody
988 server = /usr/bin/git-daemon
989 server_args = --inetd --export-all --base-path=/pub/scm
990 log_on_failure += USERID
991 }</tt></pre>
992 </div></div>
993 <div class="paragraph"><p>Check your xinetd(8) documentation and setup, this is from a Fedora system.
994 Others might be different.</p></div>
995 </dd>
996 <dt class="hdlist1">
997 Give push/pull only access to developers.
998 </dt>
999 <dd>
1000 <div class="listingblock">
1001 <div class="content">
1002 <pre><tt>$ grep git /etc/passwd <b>&lt;1&gt;</b>
1003 alice:x:1000:1000::/home/alice:/usr/bin/git-shell
1004 bob:x:1001:1001::/home/bob:/usr/bin/git-shell
1005 cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
1006 david:x:1003:1003::/home/david:/usr/bin/git-shell
1007 $ grep git /etc/shells <b>&lt;2&gt;</b>
1008 /usr/bin/git-shell</tt></pre>
1009 </div></div>
1010 <div class="colist arabic"><ol>
1011 <li>
1013 log-in shell is set to /usr/bin/git-shell, which does not
1014 allow anything but <tt>git push</tt> and <tt>git pull</tt>. The users should
1015 get an ssh access to the machine.
1016 </p>
1017 </li>
1018 <li>
1020 in many distributions /etc/shells needs to list what is used
1021 as the login shell.
1022 </p>
1023 </li>
1024 </ol></div>
1025 </dd>
1026 <dt class="hdlist1">
1027 CVS-style shared repository.
1028 </dt>
1029 <dd>
1030 <div class="listingblock">
1031 <div class="content">
1032 <pre><tt>$ grep git /etc/group <b>&lt;1&gt;</b>
1033 git:x:9418:alice,bob,cindy,david
1034 $ cd /home/devo.git
1035 $ ls -l <b>&lt;2&gt;</b>
1036 lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -&gt; refs/heads/master
1037 drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches
1038 -rw-rw-r-- 1 david git 84 Dec 4 22:40 config
1039 -rw-rw-r-- 1 david git 58 Dec 4 22:40 description
1040 drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks
1041 -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index
1042 drwxrwsr-x 2 david git 4096 Dec 4 22:40 info
1043 drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects
1044 drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs
1045 drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes
1046 $ ls -l hooks/update <b>&lt;3&gt;</b>
1047 -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update
1048 $ cat info/allowed-users <b>&lt;4&gt;</b>
1049 refs/heads/master alice\|cindy
1050 refs/heads/doc-update bob
1051 refs/tags/v[0-9]* david</tt></pre>
1052 </div></div>
1053 <div class="colist arabic"><ol>
1054 <li>
1056 place the developers into the same git group.
1057 </p>
1058 </li>
1059 <li>
1061 and make the shared repository writable by the group.
1062 </p>
1063 </li>
1064 <li>
1066 use update-hook example by Carl from Documentation/howto/
1067 for branch policy control.
1068 </p>
1069 </li>
1070 <li>
1072 alice and cindy can push into master, only bob can push into doc-update.
1073 david is the release manager and is the only person who can
1074 create and push version tags.
1075 </p>
1076 </li>
1077 </ol></div>
1078 </dd>
1079 <dt class="hdlist1">
1080 HTTP server to support dumb protocol transfer.
1081 </dt>
1082 <dd>
1083 <div class="listingblock">
1084 <div class="content">
1085 <pre><tt>dev$ git update-server-info <b>&lt;1&gt;</b>
1086 dev$ ftp user@isp.example.com <b>&lt;2&gt;</b>
1087 ftp&gt; cp -r .git /home/user/myproject.git</tt></pre>
1088 </div></div>
1089 <div class="colist arabic"><ol>
1090 <li>
1092 make sure your info/refs and objects/info/packs are up-to-date
1093 </p>
1094 </li>
1095 <li>
1097 upload to public HTTP server hosted by your ISP.
1098 </p>
1099 </li>
1100 </ol></div>
1101 </dd>
1102 </dl></div>
1103 </div>
1104 <div id="footer">
1105 <div id="footer-text">
1106 Last updated 2010-11-25 03:13:39 UTC
1107 </div>
1108 </div>
1109 </body>
1110 </html>