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