Autogenerated HTML docs for v1.2.4-g79f5
[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.1" />\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>\r
334 \r
335 <b>(1)</b> running without "--full" is usually cheap and assures the\r
336 repository health reasonably well.\r
337 <b>(2)</b> check how many loose objects there are and how much\r
338 diskspace is wasted by not repacking.\r
339 <b>(3)</b> without "-a" repacks incrementally.  repacking every 4-5MB\r
340 of loose objects accumulation may be a good rule of thumb.\r
341 <b>(4)</b> after repack, prune removes the duplicate loose objects.</tt></pre>\r
342 </div></div>\r
343 </dd>\r
344 <dt>\r
345 Repack a small project into single pack.\r
346 </dt>\r
347 <dd>\r
348 <div class="listingblock">\r
349 <div class="content">\r
350 <pre><tt>$ git repack -a -d <b>(1)</b>\r
351 $ git prune\r
352 \r
353 <b>(1)</b> pack all the objects reachable from the refs into one pack\r
354 and remove unneeded other packs</tt></pre>\r
355 </div></div>\r
356 </dd>\r
357 </dl>\r
358 </div>\r
359 <h2>Individual Developer (Standalone)<a id="Individual Developer (Standalone)"></a></h2>\r
360 <div class="sectionbody">\r
361 <p>A standalone individual developer does not exchange patches with\r
362 other poeple, and works alone in a single repository, using the\r
363 following commands.</p>\r
364 <ul>\r
365 <li>\r
366 <p>\r
367 <a href="git-show-branch.html">git-show-branch(1)</a> to see where you are.\r
368 </p>\r
369 </li>\r
370 <li>\r
371 <p>\r
372 <a href="git-log.html">git-log(1)</a> to see what happened.\r
373 </p>\r
374 </li>\r
375 <li>\r
376 <p>\r
377 <a href="git-whatchanged.html">git-whatchanged(1)</a> to find out where things have\r
378     come from.\r
379 </p>\r
380 </li>\r
381 <li>\r
382 <p>\r
383 <a href="git-checkout.html">git-checkout(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch\r
384     branches.\r
385 </p>\r
386 </li>\r
387 <li>\r
388 <p>\r
389 <a href="git-add.html">git-add(1)</a> and <a href="git-update-index.html">git-update-index(1)</a> to manage\r
390     the index file.\r
391 </p>\r
392 </li>\r
393 <li>\r
394 <p>\r
395 <a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what\r
396     you are in the middle of doing.\r
397 </p>\r
398 </li>\r
399 <li>\r
400 <p>\r
401 <a href="git-commit.html">git-commit(1)</a> to advance the current branch.\r
402 </p>\r
403 </li>\r
404 <li>\r
405 <p>\r
406 <a href="git-reset.html">git-reset(1)</a> and <a href="git-checkout.html">git-checkout(1)</a> (with\r
407     pathname parameters) to undo changes.\r
408 </p>\r
409 </li>\r
410 <li>\r
411 <p>\r
412 <a href="git-pull.html">git-pull(1)</a> with "." as the remote to merge between\r
413     local branches.\r
414 </p>\r
415 </li>\r
416 <li>\r
417 <p>\r
418 <a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches.\r
419 </p>\r
420 </li>\r
421 <li>\r
422 <p>\r
423 <a href="git-tag.html">git-tag(1)</a> to mark known point.\r
424 </p>\r
425 </li>\r
426 </ul>\r
427 <h3>Examples</h3>\r
428 <dl>\r
429 <dt>\r
430 Extract a tarball and create a working tree and a new repository to keep track of it.\r
431 </dt>\r
432 <dd>\r
433 <div class="listingblock">\r
434 <div class="content">\r
435 <pre><tt>$ tar zxf frotz.tar.gz\r
436 $ cd frotz\r
437 $ git-init-db\r
438 $ git add . <b>(1)</b>\r
439 $ git commit -m 'import of frotz source tree.'\r
440 $ git tag v2.43 <b>(2)</b>\r
441 \r
442 <b>(1)</b> add everything under the current directory.\r
443 <b>(2)</b> make a lightweight, unannotated tag.</tt></pre>\r
444 </div></div>\r
445 </dd>\r
446 <dt>\r
447 Create a topic branch and develop.\r
448 </dt>\r
449 <dd>\r
450 <div class="listingblock">\r
451 <div class="content">\r
452 <pre><tt>$ git checkout -b alsa-audio <b>(1)</b>\r
453 $ edit/compile/test\r
454 $ git checkout -- curses/ux_audio_oss.c <b>(2)</b>\r
455 $ git add curses/ux_audio_alsa.c <b>(3)</b>\r
456 $ edit/compile/test\r
457 $ git diff <b>(4)</b>\r
458 $ git commit -a -s <b>(5)</b>\r
459 $ edit/compile/test\r
460 $ git reset --soft HEAD^ <b>(6)</b>\r
461 $ edit/compile/test\r
462 $ git diff ORIG_HEAD <b>(7)</b>\r
463 $ git commit -a -c ORIG_HEAD <b>(8)</b>\r
464 $ git checkout master <b>(9)</b>\r
465 $ git pull . alsa-audio <b>(10)</b>\r
466 $ git log --since='3 days ago' <b>(11)</b>\r
467 $ git log v2.43.. curses/ <b>(12)</b>\r
468 \r
469 <b>(1)</b> create a new topic branch.\r
470 <b>(2)</b> revert your botched changes in "curses/ux_audio_oss.c".\r
471 <b>(3)</b> you need to tell git if you added a new file; removal and\r
472 modification will be caught if you do "commit -a" later.\r
473 <b>(4)</b> to see what changes you are committing.\r
474 <b>(5)</b> commit everything as you have tested, with your sign-off.\r
475 <b>(6)</b> take the last commit back, keeping what is in the working tree.\r
476 <b>(7)</b> look at the changes since the premature commit we took back.\r
477 <b>(8)</b> redo the commit undone in the previous step, using the message\r
478 you originally wrote.\r
479 <b>(9)</b> switch to the master branch.\r
480 <b>(10)</b> merge a topic branch into your master branch\r
481 <b>(11)</b> review commit logs; other forms to limit output can be\r
482 combined and include --max-count=10 (show 10 commits), --until='2005-12-10'.\r
483 <b>(12)</b> view only the changes that touch what's in curses/\r
484 directory, since v2.43 tag.</tt></pre>\r
485 </div></div>\r
486 </dd>\r
487 </dl>\r
488 </div>\r
489 <h2>Individual Developer (Participant)<a id="Individual Developer (Participant)"></a></h2>\r
490 <div class="sectionbody">\r
491 <p>A developer working as a participant in a group project needs to\r
492 learn how to communicate with others, and uses these commands in\r
493 addition to the ones needed by a standalone developer.</p>\r
494 <ul>\r
495 <li>\r
496 <p>\r
497 <a href="git-clone.html">git-clone(1)</a> from the upstream to prime your local\r
498     repository.\r
499 </p>\r
500 </li>\r
501 <li>\r
502 <p>\r
503 <a href="git-pull.html">git-pull(1)</a> and <a href="git-fetch.html">git-fetch(1)</a> from "origin"\r
504     to keep up-to-date with the upstream.\r
505 </p>\r
506 </li>\r
507 <li>\r
508 <p>\r
509 <a href="git-push.html">git-push(1)</a> to shared repository, if you adopt CVS\r
510     style shared repository workflow.\r
511 </p>\r
512 </li>\r
513 <li>\r
514 <p>\r
515 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare e-mail submission, if\r
516     you adopt Linux kernel-style public forum workflow.\r
517 </p>\r
518 </li>\r
519 </ul>\r
520 <h3>Examples</h3>\r
521 <dl>\r
522 <dt>\r
523 Clone the upstream and work on it.  Feed changes to upstream.\r
524 </dt>\r
525 <dd>\r
526 <div class="listingblock">\r
527 <div class="content">\r
528 <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6\r
529 $ cd my2.6\r
530 $ edit/compile/test; git commit -a -s <b>(1)</b>\r
531 $ git format-patch origin <b>(2)</b>\r
532 $ git pull <b>(3)</b>\r
533 $ git whatchanged -p ORIG_HEAD.. arch/i386 include/asm-i386 <b>(4)</b>\r
534 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <b>(5)</b>\r
535 $ git reset --hard ORIG_HEAD <b>(6)</b>\r
536 $ git prune <b>(7)</b>\r
537 $ git fetch --tags <b>(8)</b>\r
538 \r
539 <b>(1)</b> repeat as needed.\r
540 <b>(2)</b> extract patches from your branch for e-mail submission.\r
541 <b>(3)</b> "pull" fetches from "origin" by default and merges into the\r
542 current branch.\r
543 <b>(4)</b> immediately after pulling, look at the changes done upstream\r
544 since last time we checked, only in the\r
545 area we are interested in.\r
546 <b>(5)</b> fetch from a specific branch from a specific repository and merge.\r
547 <b>(6)</b> revert the pull.\r
548 <b>(7)</b> garbage collect leftover objects from reverted pull.\r
549 <b>(8)</b> from time to time, obtain official tags from the "origin"\r
550 and store them under .git/refs/tags/.</tt></pre>\r
551 </div></div>\r
552 </dd>\r
553 <dt>\r
554 Push into another repository.\r
555 </dt>\r
556 <dd>\r
557 <div class="listingblock">\r
558 <div class="content">\r
559 <pre><tt>satellite$ git clone mothership:frotz/.git frotz <b>(1)</b>\r
560 satellite$ cd frotz\r
561 satellite$ cat .git/remotes/origin <b>(2)</b>\r
562 URL: mothership:frotz/.git\r
563 Pull: master:origin\r
564 satellite$ echo 'Push: master:satellite' &gt;&gt;.git/remotes/origin <b>(3)</b>\r
565 satellite$ edit/compile/test/commit\r
566 satellite$ git push origin <b>(4)</b>\r
567 \r
568 mothership$ cd frotz\r
569 mothership$ git checkout master\r
570 mothership$ git pull . satellite <b>(5)</b>\r
571 \r
572 <b>(1)</b> mothership machine has a frotz repository under your home\r
573 directory; clone from it to start a repository on the satellite\r
574 machine.\r
575 <b>(2)</b> clone creates this file by default.  It arranges "git pull"\r
576 to fetch and store the master branch head of mothership machine\r
577 to local "origin" branch.\r
578 <b>(3)</b> arrange "git push" to push local "master" branch to\r
579 "satellite" branch of the mothership machine.\r
580 <b>(4)</b> push will stash our work away on "satellite" branch on the\r
581 mothership machine.  You could use this as a back-up method.\r
582 <b>(5)</b> on mothership machine, merge the work done on the satellite\r
583 machine into the master branch.</tt></pre>\r
584 </div></div>\r
585 </dd>\r
586 <dt>\r
587 Branch off of a specific tag.\r
588 </dt>\r
589 <dd>\r
590 <div class="listingblock">\r
591 <div class="content">\r
592 <pre><tt>$ git checkout -b private2.6.14 v2.6.14 <b>(1)</b>\r
593 $ edit/compile/test; git commit -a\r
594 $ git checkout master\r
595 $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |\r
596   git am -3 -k <b>(2)</b>\r
597 \r
598 <b>(1)</b> create a private branch based on a well known (but somewhat behind)\r
599 tag.\r
600 <b>(2)</b> forward port all changes in private2.6.14 branch to master branch\r
601 without a formal "merging".</tt></pre>\r
602 </div></div>\r
603 </dd>\r
604 </dl>\r
605 </div>\r
606 <h2>Integrator<a id="Integrator"></a></h2>\r
607 <div class="sectionbody">\r
608 <p>A fairly central person acting as the integrator in a group\r
609 project receives changes made by others, reviews and integrates\r
610 them and publishes the result for others to use, using these\r
611 commands in addition to the ones needed by participants.</p>\r
612 <ul>\r
613 <li>\r
614 <p>\r
615 <a href="git-am.html">git-am(1)</a> to apply patches e-mailed in from your\r
616     contributors.\r
617 </p>\r
618 </li>\r
619 <li>\r
620 <p>\r
621 <a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants.\r
622 </p>\r
623 </li>\r
624 <li>\r
625 <p>\r
626 <a href="git-format-patch.html">git-format-patch(1)</a> to prepare and send suggested\r
627     alternative to contributors.\r
628 </p>\r
629 </li>\r
630 <li>\r
631 <p>\r
632 <a href="git-revert.html">git-revert(1)</a> to undo botched commits.\r
633 </p>\r
634 </li>\r
635 <li>\r
636 <p>\r
637 <a href="git-push.html">git-push(1)</a> to publish the bleeding edge.\r
638 </p>\r
639 </li>\r
640 </ul>\r
641 <h3>Examples</h3>\r
642 <dl>\r
643 <dt>\r
644 My typical GIT day.\r
645 </dt>\r
646 <dd>\r
647 <div class="listingblock">\r
648 <div class="content">\r
649 <pre><tt>$ git status <b>(1)</b>\r
650 $ git show-branch <b>(2)</b>\r
651 $ mailx <b>(3)</b>\r
652 &amp; s 2 3 4 5 ./+to-apply\r
653 &amp; s 7 8 ./+hold-linus\r
654 &amp; q\r
655 $ git checkout master\r
656 $ git am -3 -i -s -u ./+to-apply <b>(4)</b>\r
657 $ compile/test\r
658 $ git checkout -b hold/linus &amp;&amp; git am -3 -i -s -u ./+hold-linus <b>(5)</b>\r
659 $ git checkout topic/one &amp;&amp; git rebase master <b>(6)</b>\r
660 $ git checkout pu &amp;&amp; git reset --hard master <b>(7)</b>\r
661 $ git pull . topic/one topic/two &amp;&amp; git pull . hold/linus <b>(8)</b>\r
662 $ git checkout maint\r
663 $ git cherry-pick master~4 <b>(9)</b>\r
664 $ compile/test\r
665 $ git tag -s -m 'GIT 0.99.9x' v0.99.9x <b>(10)</b>\r
666 $ git fetch ko &amp;&amp; git show-branch master maint 'tags/ko-*' <b>(11)</b>\r
667 $ git push ko <b>(12)</b>\r
668 $ git push ko v0.99.9x <b>(13)</b>\r
669 \r
670 <b>(1)</b> see what I was in the middle of doing, if any.\r
671 <b>(2)</b> see what topic branches I have and think about how ready\r
672 they are.\r
673 <b>(3)</b> read mails, save ones that are applicable, and save others\r
674 that are not quite ready.\r
675 <b>(4)</b> apply them, interactively, with my sign-offs.\r
676 <b>(5)</b> create topic branch as needed and apply, again with my\r
677 sign-offs.\r
678 <b>(6)</b> rebase internal topic branch that has not been merged to the\r
679 master, nor exposed as a part of a stable branch.\r
680 <b>(7)</b> restart "pu" every time from the master.\r
681 <b>(8)</b> and bundle topic branches still cooking.\r
682 <b>(9)</b> backport a critical fix.\r
683 <b>(10)</b> create a signed tag.\r
684 <b>(11)</b> make sure I did not accidentally rewind master beyond what I\r
685 already pushed out.  "ko" shorthand points at the repository I have\r
686 at kernel.org, and looks like this:\r
687     $ cat .git/remotes/ko\r
688     URL: kernel.org:/pub/scm/git/git.git\r
689     Pull: master:refs/tags/ko-master\r
690     Pull: maint:refs/tags/ko-maint\r
691     Push: master\r
692     Push: +pu\r
693     Push: maint\r
694 In the output from "git show-branch", "master" should have\r
695 everything "ko-master" has.\r
696 <b>(12)</b> push out the bleeding edge.\r
697 <b>(13)</b> push the tag out, too.</tt></pre>\r
698 </div></div>\r
699 </dd>\r
700 </dl>\r
701 </div>\r
702 <h2>Repository Administration<a id="Repository Administration"></a></h2>\r
703 <div class="sectionbody">\r
704 <p>A repository administrator uses the following tools to set up\r
705 and maintain access to the repository by developers.</p>\r
706 <ul>\r
707 <li>\r
708 <p>\r
709 <a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from\r
710     repository.\r
711 </p>\r
712 </li>\r
713 <li>\r
714 <p>\r
715 <a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em>\r
716     for shared central repository users.\r
717 </p>\r
718 </li>\r
719 </ul>\r
720 <p><a href="howto/update-hook-example.txt">update hook howto</a> has a good\r
721 example of managing a shared central repository.</p>\r
722 <h3>Examples</h3>\r
723 <dl>\r
724 <dt>\r
725 Run git-daemon to serve /pub/scm from inetd.\r
726 </dt>\r
727 <dd>\r
728 <div class="listingblock">\r
729 <div class="content">\r
730 <pre><tt>$ grep git /etc/inet.conf\r
731 git     stream  tcp     nowait  nobody \\r
732   /usr/bin/git-daemon git-daemon --inetd --syslog --export-all /pub/scm</tt></pre>\r
733 </div></div>\r
734 <p>The actual configuration line should be on one line.</p>\r
735 </dd>\r
736 <dt>\r
737 Give push/pull only access to developers.\r
738 </dt>\r
739 <dd>\r
740 <div class="listingblock">\r
741 <div class="content">\r
742 <pre><tt>$ grep git /etc/passwd <b>(1)</b>\r
743 alice:x:1000:1000::/home/alice:/usr/bin/git-shell\r
744 bob:x:1001:1001::/home/bob:/usr/bin/git-shell\r
745 cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell\r
746 david:x:1003:1003::/home/david:/usr/bin/git-shell\r
747 $ grep git /etc/shells <b>(2)</b>\r
748 /usr/bin/git-shell\r
749 \r
750 <b>(1)</b> log-in shell is set to /usr/bin/git-shell, which does not\r
751 allow anything but "git push" and "git pull".  The users should\r
752 get an ssh access to the machine.\r
753 <b>(2)</b> in many distributions /etc/shells needs to list what is used\r
754 as the login shell.</tt></pre>\r
755 </div></div>\r
756 </dd>\r
757 <dt>\r
758 CVS-style shared repository.\r
759 </dt>\r
760 <dd>\r
761 <div class="listingblock">\r
762 <div class="content">\r
763 <pre><tt>$ grep git /etc/group <b>(1)</b>\r
764 git:x:9418:alice,bob,cindy,david\r
765 $ cd /home/devo.git\r
766 $ ls -l <b>(2)</b>\r
767   lrwxrwxrwx   1 david git    17 Dec  4 22:40 HEAD -&gt; refs/heads/master\r
768   drwxrwsr-x   2 david git  4096 Dec  4 22:40 branches\r
769   -rw-rw-r--   1 david git    84 Dec  4 22:40 config\r
770   -rw-rw-r--   1 david git    58 Dec  4 22:40 description\r
771   drwxrwsr-x   2 david git  4096 Dec  4 22:40 hooks\r
772   -rw-rw-r--   1 david git 37504 Dec  4 22:40 index\r
773   drwxrwsr-x   2 david git  4096 Dec  4 22:40 info\r
774   drwxrwsr-x   4 david git  4096 Dec  4 22:40 objects\r
775   drwxrwsr-x   4 david git  4096 Nov  7 14:58 refs\r
776   drwxrwsr-x   2 david git  4096 Dec  4 22:40 remotes\r
777 $ ls -l hooks/update <b>(3)</b>\r
778   -r-xr-xr-x   1 david git  3536 Dec  4 22:40 update\r
779 $ cat info/allowed-users <b>(4)</b>\r
780 refs/heads/master       alice\|cindy\r
781 refs/heads/doc-update   bob\r
782 refs/tags/v[0-9]*       david\r
783 \r
784 <b>(1)</b> place the developers into the same git group.\r
785 <b>(2)</b> and make the shared repository writable by the group.\r
786 <b>(3)</b> use update-hook example by Carl from Documentation/howto/\r
787 for branch policy control.\r
788 <b>(4)</b> alice and cindy can push into master, only bob can push into doc-update.\r
789 david is the release manager and is the only person who can\r
790 create and push version tags.</tt></pre>\r
791 </div></div>\r
792 </dd>\r
793 <dt>\r
794 HTTP server to support dumb protocol transfer.\r
795 </dt>\r
796 <dd>\r
797 <div class="listingblock">\r
798 <div class="content">\r
799 <pre><tt>dev$ git update-server-info <b>(1)</b>\r
800 dev$ ftp user@isp.example.com <b>(2)</b>\r
801 ftp&gt; cp -r .git /home/user/myproject.git\r
802 \r
803 <b>(1)</b> make sure your info/refs and objects/info/packs are up-to-date\r
804 <b>(2)</b> upload to public HTTP server hosted by your ISP.</tt></pre>\r
805 </div></div>\r
806 </dd>\r
807 </dl>\r
808 </div>\r
809 <div id="footer">\r
810 <div id="footer-text">\r
811 Last updated 27-Dec-2005 00:17:10 PDT\r
812 </div>\r
813 </div>\r
814 </body>\r
815 </html>\r