Autogenerated HTML docs for v1.7.1
[git/jnareb-git.git] / everyday.html
blob511b7a738bb3f8656224608698567146f514d562
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.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 /* Workarounds for IE6's broken and incomplete CSS2. */
276 div.sidebar-content {
277 background: #ffffee;
278 border: 1px solid silver;
279 padding: 0.5em;
281 div.sidebar-title, div.image-title {
282 font-family: sans-serif;
283 font-weight: bold;
284 margin-top: 0.0em;
285 margin-bottom: 0.5em;
288 div.listingblock div.content {
289 border: 1px solid silver;
290 background: #f4f4f4;
291 padding: 0.5em;
294 div.quoteblock-content {
295 padding-left: 2.0em;
298 div.exampleblock-content {
299 border-left: 2px solid silver;
300 padding-left: 0.5em;
303 /* IE6 sets dynamically generated links as visited. */
304 div#toc a:visited { color: blue; }
305 </style>
306 <title>Everyday GIT With 20 Commands Or So</title>
307 </head>
308 <body>
309 <div id="header">
310 <h1>Everyday GIT With 20 Commands Or So</h1>
311 </div>
312 <div id="preamble">
313 <div class="sectionbody">
314 <div class="para"><p><a href="#Individual Developer (Standalone)">[Individual Developer (Standalone)]</a> commands are essential for
315 anybody who makes a commit, even for somebody who works alone.</p></div>
316 <div class="para"><p>If you work with other people, you will need commands listed in
317 the <a href="#Individual Developer (Participant)">[Individual Developer (Participant)]</a> section as well.</p></div>
318 <div class="para"><p>People who play the <a href="#Integrator">[Integrator]</a> role need to learn some more
319 commands in addition to the above.</p></div>
320 <div class="para"><p><a href="#Repository Administration">[Repository Administration]</a> commands are for system
321 administrators who are responsible for the care and feeding
322 of git repositories.</p></div>
323 </div>
324 </div>
325 <h2 id="_individual_developer_standalone_a_id_individual_developer_standalone_a">Individual Developer (Standalone)<a id="Individual Developer (Standalone)"></a></h2>
326 <div class="sectionbody">
327 <div class="para"><p>A standalone individual developer does not exchange patches with
328 other people, and works alone in a single repository, using the
329 following commands.</p></div>
330 <div class="ilist"><ul>
331 <li>
333 <a href="git-init.html">git-init(1)</a> to create a new repository.
334 </p>
335 </li>
336 <li>
338 <a href="git-show-branch.html">git-show-branch(1)</a> to see where you are.
339 </p>
340 </li>
341 <li>
343 <a href="git-log.html">git-log(1)</a> to see what happened.
344 </p>
345 </li>
346 <li>
348 <a href="git-checkout.html">git-checkout(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch
349 branches.
350 </p>
351 </li>
352 <li>
354 <a href="git-add.html">git-add(1)</a> to manage the index file.
355 </p>
356 </li>
357 <li>
359 <a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what
360 you are in the middle of doing.
361 </p>
362 </li>
363 <li>
365 <a href="git-commit.html">git-commit(1)</a> to advance the current branch.
366 </p>
367 </li>
368 <li>
370 <a href="git-reset.html">git-reset(1)</a> and <a href="git-checkout.html">git-checkout(1)</a> (with
371 pathname parameters) to undo changes.
372 </p>
373 </li>
374 <li>
376 <a href="git-merge.html">git-merge(1)</a> to merge between local branches.
377 </p>
378 </li>
379 <li>
381 <a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches.
382 </p>
383 </li>
384 <li>
386 <a href="git-tag.html">git-tag(1)</a> to mark known point.
387 </p>
388 </li>
389 </ul></div>
390 <h3 id="_examples">Examples</h3><div style="clear:left"></div>
391 <div class="vlist"><dl>
392 <dt>
393 Use a tarball as a starting point for a new repository.
394 </dt>
395 <dd>
396 <div class="listingblock">
397 <div class="content">
398 <pre><tt>$ tar zxf frotz.tar.gz
399 $ cd frotz
400 $ git init
401 $ git add . <b>(1)</b>
402 $ git commit -m "import of frotz source tree."
403 $ git tag v2.43 <b>(2)</b></tt></pre>
404 </div></div>
405 <div class="colist"><ol>
406 <li>
408 add everything under the current directory.
409 </p>
410 </li>
411 <li>
413 make a lightweight, unannotated tag.
414 </p>
415 </li>
416 </ol></div>
417 </dd>
418 <dt>
419 Create a topic branch and develop.
420 </dt>
421 <dd>
422 <div class="listingblock">
423 <div class="content">
424 <pre><tt>$ git checkout -b alsa-audio <b>(1)</b>
425 $ edit/compile/test
426 $ git checkout -- curses/ux_audio_oss.c <b>(2)</b>
427 $ git add curses/ux_audio_alsa.c <b>(3)</b>
428 $ edit/compile/test
429 $ git diff HEAD <b>(4)</b>
430 $ git commit -a -s <b>(5)</b>
431 $ edit/compile/test
432 $ git reset --soft HEAD^ <b>(6)</b>
433 $ edit/compile/test
434 $ git diff ORIG_HEAD <b>(7)</b>
435 $ git commit -a -c ORIG_HEAD <b>(8)</b>
436 $ git checkout master <b>(9)</b>
437 $ git merge alsa-audio <b>(10)</b>
438 $ git log --since='3 days ago' <b>(11)</b>
439 $ git log v2.43.. curses/ <b>(12)</b></tt></pre>
440 </div></div>
441 <div class="colist"><ol>
442 <li>
444 create a new topic branch.
445 </p>
446 </li>
447 <li>
449 revert your botched changes in <tt>curses/ux_audio_oss.c</tt>.
450 </p>
451 </li>
452 <li>
454 you need to tell git if you added a new file; removal and
455 modification will be caught if you do <tt>git commit -a</tt> later.
456 </p>
457 </li>
458 <li>
460 to see what changes you are committing.
461 </p>
462 </li>
463 <li>
465 commit everything as you have tested, with your sign-off.
466 </p>
467 </li>
468 <li>
470 take the last commit back, keeping what is in the working tree.
471 </p>
472 </li>
473 <li>
475 look at the changes since the premature commit we took back.
476 </p>
477 </li>
478 <li>
480 redo the commit undone in the previous step, using the message
481 you originally wrote.
482 </p>
483 </li>
484 <li>
486 switch to the master branch.
487 </p>
488 </li>
489 <li>
491 merge a topic branch into your master branch.
492 </p>
493 </li>
494 <li>
496 review commit logs; other forms to limit output can be
497 combined and include <tt>--max-count=10</tt> (show 10 commits),
498 <tt>--until=2005-12-10</tt>, etc.
499 </p>
500 </li>
501 <li>
503 view only the changes that touch what's in <tt>curses/</tt>
504 directory, since <tt>v2.43</tt> tag.
505 </p>
506 </li>
507 </ol></div>
508 </dd>
509 </dl></div>
510 </div>
511 <h2 id="_individual_developer_participant_a_id_individual_developer_participant_a">Individual Developer (Participant)<a id="Individual Developer (Participant)"></a></h2>
512 <div class="sectionbody">
513 <div class="para"><p>A developer working as a participant in a group project needs to
514 learn how to communicate with others, and uses these commands in
515 addition to the ones needed by a standalone developer.</p></div>
516 <div class="ilist"><ul>
517 <li>
519 <a href="git-clone.html">git-clone(1)</a> from the upstream to prime your local
520 repository.
521 </p>
522 </li>
523 <li>
525 <a href="git-pull.html">git-pull(1)</a> and <a href="git-fetch.html">git-fetch(1)</a> from "origin"
526 to keep up-to-date with the upstream.
527 </p>
528 </li>
529 <li>
531 <a href="git-push.html">git-push(1)</a> to shared repository, if you adopt CVS
532 style shared repository workflow.
533 </p>
534 </li>
535 <li>
537 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare e-mail submission, if
538 you adopt Linux kernel-style public forum workflow.
539 </p>
540 </li>
541 </ul></div>
542 <h3 id="_examples_2">Examples</h3><div style="clear:left"></div>
543 <div class="vlist"><dl>
544 <dt>
545 Clone the upstream and work on it. Feed changes to upstream.
546 </dt>
547 <dd>
548 <div class="listingblock">
549 <div class="content">
550 <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
551 $ cd my2.6
552 $ edit/compile/test; git commit -a -s <b>(1)</b>
553 $ git format-patch origin <b>(2)</b>
554 $ git pull <b>(3)</b>
555 $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <b>(4)</b>
556 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <b>(5)</b>
557 $ git reset --hard ORIG_HEAD <b>(6)</b>
558 $ git gc <b>(7)</b>
559 $ git fetch --tags <b>(8)</b></tt></pre>
560 </div></div>
561 <div class="colist"><ol>
562 <li>
564 repeat as needed.
565 </p>
566 </li>
567 <li>
569 extract patches from your branch for e-mail submission.
570 </p>
571 </li>
572 <li>
574 <tt>git pull</tt> fetches from <tt>origin</tt> by default and merges into the
575 current branch.
576 </p>
577 </li>
578 <li>
580 immediately after pulling, look at the changes done upstream
581 since last time we checked, only in the
582 area we are interested in.
583 </p>
584 </li>
585 <li>
587 fetch from a specific branch from a specific repository and merge.
588 </p>
589 </li>
590 <li>
592 revert the pull.
593 </p>
594 </li>
595 <li>
597 garbage collect leftover objects from reverted pull.
598 </p>
599 </li>
600 <li>
602 from time to time, obtain official tags from the <tt>origin</tt>
603 and store them under <tt>.git/refs/tags/</tt>.
604 </p>
605 </li>
606 </ol></div>
607 </dd>
608 <dt>
609 Push into another repository.
610 </dt>
611 <dd>
612 <div class="listingblock">
613 <div class="content">
614 <pre><tt>satellite$ git clone mothership:frotz frotz <b>(1)</b>
615 satellite$ cd frotz
616 satellite$ git config --get-regexp '^(remote|branch)\.' <b>(2)</b>
617 remote.origin.url mothership:frotz
618 remote.origin.fetch refs/heads/*:refs/remotes/origin/*
619 branch.master.remote origin
620 branch.master.merge refs/heads/master
621 satellite$ git config remote.origin.push \
622 master:refs/remotes/satellite/master <b>(3)</b>
623 satellite$ edit/compile/test/commit
624 satellite$ git push origin <b>(4)</b>
626 mothership$ cd frotz
627 mothership$ git checkout master
628 mothership$ git merge satellite/master <b>(5)</b></tt></pre>
629 </div></div>
630 <div class="colist"><ol>
631 <li>
633 mothership machine has a frotz repository under your home
634 directory; clone from it to start a repository on the satellite
635 machine.
636 </p>
637 </li>
638 <li>
640 clone sets these configuration variables by default.
641 It arranges <tt>git pull</tt> to fetch and store the branches of mothership
642 machine to local <tt>remotes/origin/*</tt> tracking branches.
643 </p>
644 </li>
645 <li>
647 arrange <tt>git push</tt> to push local <tt>master</tt> branch to
648 <tt>remotes/satellite/master</tt> branch of the mothership machine.
649 </p>
650 </li>
651 <li>
653 push will stash our work away on <tt>remotes/satellite/master</tt>
654 tracking branch on the mothership machine. You could use this as
655 a back-up method.
656 </p>
657 </li>
658 <li>
660 on mothership machine, merge the work done on the satellite
661 machine into the master branch.
662 </p>
663 </li>
664 </ol></div>
665 </dd>
666 <dt>
667 Branch off of a specific tag.
668 </dt>
669 <dd>
670 <div class="listingblock">
671 <div class="content">
672 <pre><tt>$ git checkout -b private2.6.14 v2.6.14 <b>(1)</b>
673 $ edit/compile/test; git commit -a
674 $ git checkout master
675 $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
676 git am -3 -k <b>(2)</b></tt></pre>
677 </div></div>
678 <div class="colist"><ol>
679 <li>
681 create a private branch based on a well known (but somewhat behind)
682 tag.
683 </p>
684 </li>
685 <li>
687 forward port all changes in <tt>private2.6.14</tt> branch to <tt>master</tt> branch
688 without a formal "merging".
689 </p>
690 </li>
691 </ol></div>
692 </dd>
693 </dl></div>
694 </div>
695 <h2 id="_integrator_a_id_integrator_a">Integrator<a id="Integrator"></a></h2>
696 <div class="sectionbody">
697 <div class="para"><p>A fairly central person acting as the integrator in a group
698 project receives changes made by others, reviews and integrates
699 them and publishes the result for others to use, using these
700 commands in addition to the ones needed by participants.</p></div>
701 <div class="ilist"><ul>
702 <li>
704 <a href="git-am.html">git-am(1)</a> to apply patches e-mailed in from your
705 contributors.
706 </p>
707 </li>
708 <li>
710 <a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants.
711 </p>
712 </li>
713 <li>
715 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare and send suggested
716 alternative to contributors.
717 </p>
718 </li>
719 <li>
721 <a href="git-revert.html">git-revert(1)</a> to undo botched commits.
722 </p>
723 </li>
724 <li>
726 <a href="git-push.html">git-push(1)</a> to publish the bleeding edge.
727 </p>
728 </li>
729 </ul></div>
730 <h3 id="_examples_3">Examples</h3><div style="clear:left"></div>
731 <div class="vlist"><dl>
732 <dt>
733 My typical GIT day.
734 </dt>
735 <dd>
736 <div class="listingblock">
737 <div class="content">
738 <pre><tt>$ git status <b>(1)</b>
739 $ git show-branch <b>(2)</b>
740 $ mailx <b>(3)</b>
741 &amp; s 2 3 4 5 ./+to-apply
742 &amp; s 7 8 ./+hold-linus
743 &amp; q
744 $ git checkout -b topic/one master
745 $ git am -3 -i -s -u ./+to-apply <b>(4)</b>
746 $ compile/test
747 $ git checkout -b hold/linus &amp;&amp; git am -3 -i -s -u ./+hold-linus <b>(5)</b>
748 $ git checkout topic/one &amp;&amp; git rebase master <b>(6)</b>
749 $ git checkout pu &amp;&amp; git reset --hard next <b>(7)</b>
750 $ git merge topic/one topic/two &amp;&amp; git merge hold/linus <b>(8)</b>
751 $ git checkout maint
752 $ git cherry-pick master~4 <b>(9)</b>
753 $ compile/test
754 $ git tag -s -m "GIT 0.99.9x" v0.99.9x <b>(10)</b>
755 $ git fetch ko &amp;&amp; git show-branch master maint 'tags/ko-*' <b>(11)</b>
756 $ git push ko <b>(12)</b>
757 $ git push ko v0.99.9x <b>(13)</b></tt></pre>
758 </div></div>
759 <div class="colist"><ol>
760 <li>
762 see what I was in the middle of doing, if any.
763 </p>
764 </li>
765 <li>
767 see what topic branches I have and think about how ready
768 they are.
769 </p>
770 </li>
771 <li>
773 read mails, save ones that are applicable, and save others
774 that are not quite ready.
775 </p>
776 </li>
777 <li>
779 apply them, interactively, with my sign-offs.
780 </p>
781 </li>
782 <li>
784 create topic branch as needed and apply, again with my
785 sign-offs.
786 </p>
787 </li>
788 <li>
790 rebase internal topic branch that has not been merged to the
791 master, nor exposed as a part of a stable branch.
792 </p>
793 </li>
794 <li>
796 restart <tt>pu</tt> every time from the next.
797 </p>
798 </li>
799 <li>
801 and bundle topic branches still cooking.
802 </p>
803 </li>
804 <li>
806 backport a critical fix.
807 </p>
808 </li>
809 <li>
811 create a signed tag.
812 </p>
813 </li>
814 <li>
816 make sure I did not accidentally rewind master beyond what I
817 already pushed out. <tt>ko</tt> shorthand points at the repository I have
818 at kernel.org, and looks like this:
819 </p>
820 <div class="listingblock">
821 <div class="content">
822 <pre><tt>$ cat .git/remotes/ko
823 URL: kernel.org:/pub/scm/git/git.git
824 Pull: master:refs/tags/ko-master
825 Pull: next:refs/tags/ko-next
826 Pull: maint:refs/tags/ko-maint
827 Push: master
828 Push: next
829 Push: +pu
830 Push: maint</tt></pre>
831 </div></div>
832 <div class="para"><p>In the output from <tt>git show-branch</tt>, <tt>master</tt> should have
833 everything <tt>ko-master</tt> has, and <tt>next</tt> should have
834 everything <tt>ko-next</tt> has.</p></div>
835 </li>
836 <li>
838 push out the bleeding edge.
839 </p>
840 </li>
841 <li>
843 push the tag out, too.
844 </p>
845 </li>
846 </ol></div>
847 </dd>
848 </dl></div>
849 </div>
850 <h2 id="_repository_administration_a_id_repository_administration_a">Repository Administration<a id="Repository Administration"></a></h2>
851 <div class="sectionbody">
852 <div class="para"><p>A repository administrator uses the following tools to set up
853 and maintain access to the repository by developers.</p></div>
854 <div class="ilist"><ul>
855 <li>
857 <a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from
858 repository.
859 </p>
860 </li>
861 <li>
863 <a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em>
864 for shared central repository users.
865 </p>
866 </li>
867 </ul></div>
868 <div class="para"><p><a href="howto/update-hook-example.txt">update hook howto</a> has a good
869 example of managing a shared central repository.</p></div>
870 <h3 id="_examples_4">Examples</h3><div style="clear:left"></div>
871 <div class="vlist"><dl>
872 <dt>
873 We assume the following in /etc/services
874 </dt>
875 <dd>
876 <div class="listingblock">
877 <div class="content">
878 <pre><tt>$ grep 9418 /etc/services
879 git 9418/tcp # Git Version Control System</tt></pre>
880 </div></div>
881 </dd>
882 <dt>
883 Run git-daemon to serve /pub/scm from inetd.
884 </dt>
885 <dd>
886 <div class="listingblock">
887 <div class="content">
888 <pre><tt>$ grep git /etc/inetd.conf
889 git stream tcp nowait nobody \
890 /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</tt></pre>
891 </div></div>
892 <div class="para"><p>The actual configuration line should be on one line.</p></div>
893 </dd>
894 <dt>
895 Run git-daemon to serve /pub/scm from xinetd.
896 </dt>
897 <dd>
898 <div class="listingblock">
899 <div class="content">
900 <pre><tt>$ cat /etc/xinetd.d/git-daemon
901 # default: off
902 # description: The git server offers access to git repositories
903 service git
905 disable = no
906 type = UNLISTED
907 port = 9418
908 socket_type = stream
909 wait = no
910 user = nobody
911 server = /usr/bin/git-daemon
912 server_args = --inetd --export-all --base-path=/pub/scm
913 log_on_failure += USERID
914 }</tt></pre>
915 </div></div>
916 <div class="para"><p>Check your xinetd(8) documentation and setup, this is from a Fedora system.
917 Others might be different.</p></div>
918 </dd>
919 <dt>
920 Give push/pull only access to developers.
921 </dt>
922 <dd>
923 <div class="listingblock">
924 <div class="content">
925 <pre><tt>$ grep git /etc/passwd <b>(1)</b>
926 alice:x:1000:1000::/home/alice:/usr/bin/git-shell
927 bob:x:1001:1001::/home/bob:/usr/bin/git-shell
928 cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
929 david:x:1003:1003::/home/david:/usr/bin/git-shell
930 $ grep git /etc/shells <b>(2)</b>
931 /usr/bin/git-shell</tt></pre>
932 </div></div>
933 <div class="colist"><ol>
934 <li>
936 log-in shell is set to /usr/bin/git-shell, which does not
937 allow anything but <tt>git push</tt> and <tt>git pull</tt>. The users should
938 get an ssh access to the machine.
939 </p>
940 </li>
941 <li>
943 in many distributions /etc/shells needs to list what is used
944 as the login shell.
945 </p>
946 </li>
947 </ol></div>
948 </dd>
949 <dt>
950 CVS-style shared repository.
951 </dt>
952 <dd>
953 <div class="listingblock">
954 <div class="content">
955 <pre><tt>$ grep git /etc/group <b>(1)</b>
956 git:x:9418:alice,bob,cindy,david
957 $ cd /home/devo.git
958 $ ls -l <b>(2)</b>
959 lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -&gt; refs/heads/master
960 drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches
961 -rw-rw-r-- 1 david git 84 Dec 4 22:40 config
962 -rw-rw-r-- 1 david git 58 Dec 4 22:40 description
963 drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks
964 -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index
965 drwxrwsr-x 2 david git 4096 Dec 4 22:40 info
966 drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects
967 drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs
968 drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes
969 $ ls -l hooks/update <b>(3)</b>
970 -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update
971 $ cat info/allowed-users <b>(4)</b>
972 refs/heads/master alice\|cindy
973 refs/heads/doc-update bob
974 refs/tags/v[0-9]* david</tt></pre>
975 </div></div>
976 <div class="colist"><ol>
977 <li>
979 place the developers into the same git group.
980 </p>
981 </li>
982 <li>
984 and make the shared repository writable by the group.
985 </p>
986 </li>
987 <li>
989 use update-hook example by Carl from Documentation/howto/
990 for branch policy control.
991 </p>
992 </li>
993 <li>
995 alice and cindy can push into master, only bob can push into doc-update.
996 david is the release manager and is the only person who can
997 create and push version tags.
998 </p>
999 </li>
1000 </ol></div>
1001 </dd>
1002 <dt>
1003 HTTP server to support dumb protocol transfer.
1004 </dt>
1005 <dd>
1006 <div class="listingblock">
1007 <div class="content">
1008 <pre><tt>dev$ git update-server-info <b>(1)</b>
1009 dev$ ftp user@isp.example.com <b>(2)</b>
1010 ftp&gt; cp -r .git /home/user/myproject.git</tt></pre>
1011 </div></div>
1012 <div class="colist"><ol>
1013 <li>
1015 make sure your info/refs and objects/info/packs are up-to-date
1016 </p>
1017 </li>
1018 <li>
1020 upload to public HTTP server hosted by your ISP.
1021 </p>
1022 </li>
1023 </ol></div>
1024 </dd>
1025 </dl></div>
1026 </div>
1027 <div id="footer">
1028 <div id="footer-text">
1029 Last updated 2010-04-24 02:56:16 UTC
1030 </div>
1031 </div>
1032 </body>
1033 </html>