updated git doc
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / everyday.xml
blob68cb6b51fd497a6ae7536a4ba9e27959d5fcd7ef
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <article lang="en" id="everyday">\r
5 <articleinfo>\r
6     <title>Everyday GIT With 20 Commands Or So</title>\r
7 <indexterm>\r
8 <primary>Everyday GIT With 20 Commands Or So</primary>\r
9 </indexterm>\r
10 </articleinfo>\r
11 <simpara><xref linkend="Individual Developer (Standalone)"/> commands are essential for\r
12 anybody who makes a commit, even for somebody who works alone.</simpara>\r
13 <simpara>If you work with other people, you will need commands listed in\r
14 the <xref linkend="Individual Developer (Participant)"/> section as well.</simpara>\r
15 <simpara>People who play the <xref linkend="Integrator"/> role need to learn some more\r
16 commands in addition to the above.</simpara>\r
17 <simpara><xref linkend="Repository Administration"/> commands are for system\r
18 administrators who are responsible for the care and feeding\r
19 of git repositories.</simpara>\r
20 <simplesect id="_individual_developer_standalone_anchor_id_individual_developer_standalone_xreflabel_individual_developer_standalone">\r
21 <title>Individual Developer (Standalone)<anchor id="Individual Developer (Standalone)" xreflabel="[Individual Developer (Standalone)]"/></title>\r
22 <simpara>A standalone individual developer does not exchange patches with\r
23 other people, and works alone in a single repository, using the\r
24 following commands.</simpara>\r
25 <itemizedlist>\r
26 <listitem>\r
27 <simpara>\r
28 <xref linkend="git-init(1)" /> to create a new repository.\r
29 </simpara>\r
30 </listitem>\r
31 <listitem>\r
32 <simpara>\r
33 <xref linkend="git-show-branch(1)" /> to see where you are.\r
34 </simpara>\r
35 </listitem>\r
36 <listitem>\r
37 <simpara>\r
38 <xref linkend="git-log(1)" /> to see what happened.\r
39 </simpara>\r
40 </listitem>\r
41 <listitem>\r
42 <simpara>\r
43 <xref linkend="git-checkout(1)" /> and <xref linkend="git-branch(1)" /> to switch\r
44     branches.\r
45 </simpara>\r
46 </listitem>\r
47 <listitem>\r
48 <simpara>\r
49 <xref linkend="git-add(1)" /> to manage the index file.\r
50 </simpara>\r
51 </listitem>\r
52 <listitem>\r
53 <simpara>\r
54 <xref linkend="git-diff(1)" /> and <xref linkend="git-status(1)" /> to see what\r
55     you are in the middle of doing.\r
56 </simpara>\r
57 </listitem>\r
58 <listitem>\r
59 <simpara>\r
60 <xref linkend="git-commit(1)" /> to advance the current branch.\r
61 </simpara>\r
62 </listitem>\r
63 <listitem>\r
64 <simpara>\r
65 <xref linkend="git-reset(1)" /> and <xref linkend="git-checkout(1)" /> (with\r
66     pathname parameters) to undo changes.\r
67 </simpara>\r
68 </listitem>\r
69 <listitem>\r
70 <simpara>\r
71 <xref linkend="git-merge(1)" /> to merge between local branches.\r
72 </simpara>\r
73 </listitem>\r
74 <listitem>\r
75 <simpara>\r
76 <xref linkend="git-rebase(1)" /> to maintain topic branches.\r
77 </simpara>\r
78 </listitem>\r
79 <listitem>\r
80 <simpara>\r
81 <xref linkend="git-tag(1)" /> to mark known point.\r
82 </simpara>\r
83 </listitem>\r
84 </itemizedlist>\r
85 <section id="_examples">\r
86 <title>Examples</title>\r
87 <variablelist>\r
88 <varlistentry>\r
89 <term>\r
90 Use a tarball as a starting point for a new repository.\r
91 </term>\r
92 <listitem>\r
93 <screen>$ tar zxf frotz.tar.gz\r
94 $ cd frotz\r
95 $ git init\r
96 $ git add . <co id="CO1-1"/>\r
97 $ git commit -m "import of frotz source tree."\r
98 $ git tag v2.43 <co id="CO1-2"/></screen>\r
99 <calloutlist>\r
100 <callout arearefs="CO1-1">\r
101 <para>\r
102 add everything under the current directory.\r
103 </para>\r
104 </callout>\r
105 <callout arearefs="CO1-2">\r
106 <para>\r
107 make a lightweight, unannotated tag.\r
108 </para>\r
109 </callout>\r
110 </calloutlist>\r
111 </listitem>\r
112 </varlistentry>\r
113 <varlistentry>\r
114 <term>\r
115 Create a topic branch and develop.\r
116 </term>\r
117 <listitem>\r
118 <screen>$ git checkout -b alsa-audio <co id="CO2-1"/>\r
119 $ edit/compile/test\r
120 $ git checkout -- curses/ux_audio_oss.c <co id="CO2-2"/>\r
121 $ git add curses/ux_audio_alsa.c <co id="CO2-3"/>\r
122 $ edit/compile/test\r
123 $ git diff HEAD <co id="CO2-4"/>\r
124 $ git commit -a -s <co id="CO2-5"/>\r
125 $ edit/compile/test\r
126 $ git reset --soft HEAD^ <co id="CO2-6"/>\r
127 $ edit/compile/test\r
128 $ git diff ORIG_HEAD <co id="CO2-7"/>\r
129 $ git commit -a -c ORIG_HEAD <co id="CO2-8"/>\r
130 $ git checkout master <co id="CO2-9"/>\r
131 $ git merge alsa-audio <co id="CO2-10"/>\r
132 $ git log --since='3 days ago' <co id="CO2-11"/>\r
133 $ git log v2.43.. curses/ <co id="CO2-12"/></screen>\r
134 <calloutlist>\r
135 <callout arearefs="CO2-1">\r
136 <para>\r
137 create a new topic branch.\r
138 </para>\r
139 </callout>\r
140 <callout arearefs="CO2-2">\r
141 <para>\r
142 revert your botched changes in <emphasis>curses/ux_audio_oss.c</emphasis>.\r
143 </para>\r
144 </callout>\r
145 <callout arearefs="CO2-3">\r
146 <para>\r
147 you need to tell git if you added a new file; removal and\r
148 modification will be caught if you do <emphasis>git commit -a</emphasis> later.\r
149 </para>\r
150 </callout>\r
151 <callout arearefs="CO2-4">\r
152 <para>\r
153 to see what changes you are committing.\r
154 </para>\r
155 </callout>\r
156 <callout arearefs="CO2-5">\r
157 <para>\r
158 commit everything as you have tested, with your sign-off.\r
159 </para>\r
160 </callout>\r
161 <callout arearefs="CO2-6">\r
162 <para>\r
163 take the last commit back, keeping what is in the working tree.\r
164 </para>\r
165 </callout>\r
166 <callout arearefs="CO2-7">\r
167 <para>\r
168 look at the changes since the premature commit we took back.\r
169 </para>\r
170 </callout>\r
171 <callout arearefs="CO2-8">\r
172 <para>\r
173 redo the commit undone in the previous step, using the message\r
174 you originally wrote.\r
175 </para>\r
176 </callout>\r
177 <callout arearefs="CO2-9">\r
178 <para>\r
179 switch to the master branch.\r
180 </para>\r
181 </callout>\r
182 <callout arearefs="CO2-10">\r
183 <para>\r
184 merge a topic branch into your master branch.\r
185 </para>\r
186 </callout>\r
187 <callout arearefs="CO2-11">\r
188 <para>\r
189 review commit logs; other forms to limit output can be\r
190 combined and include <emphasis>--max-count=10</emphasis> (show 10 commits),\r
191 <emphasis>--until=2005-12-10</emphasis>, etc.\r
192 </para>\r
193 </callout>\r
194 <callout arearefs="CO2-12">\r
195 <para>\r
196 view only the changes that touch what's in <emphasis>curses/</emphasis>\r
197 directory, since <emphasis>v2.43</emphasis> tag.\r
198 </para>\r
199 </callout>\r
200 </calloutlist>\r
201 </listitem>\r
202 </varlistentry>\r
203 </variablelist>\r
204 </section>\r
205 </simplesect>\r
206 <simplesect id="_individual_developer_participant_anchor_id_individual_developer_participant_xreflabel_individual_developer_participant">\r
207 <title>Individual Developer (Participant)<anchor id="Individual Developer (Participant)" xreflabel="[Individual Developer (Participant)]"/></title>\r
208 <simpara>A developer working as a participant in a group project needs to\r
209 learn how to communicate with others, and uses these commands in\r
210 addition to the ones needed by a standalone developer.</simpara>\r
211 <itemizedlist>\r
212 <listitem>\r
213 <simpara>\r
214 <xref linkend="git-clone(1)" /> from the upstream to prime your local\r
215     repository.\r
216 </simpara>\r
217 </listitem>\r
218 <listitem>\r
219 <simpara>\r
220 <xref linkend="git-pull(1)" /> and <xref linkend="git-fetch(1)" /> from "origin"\r
221     to keep up-to-date with the upstream.\r
222 </simpara>\r
223 </listitem>\r
224 <listitem>\r
225 <simpara>\r
226 <xref linkend="git-push(1)" /> to shared repository, if you adopt CVS\r
227     style shared repository workflow.\r
228 </simpara>\r
229 </listitem>\r
230 <listitem>\r
231 <simpara>\r
232 <xref linkend="git-format-patch(1)" /> to prepare e-mail submission, if\r
233     you adopt Linux kernel-style public forum workflow.\r
234 </simpara>\r
235 </listitem>\r
236 </itemizedlist>\r
237 <section id="_examples_2">\r
238 <title>Examples</title>\r
239 <variablelist>\r
240 <varlistentry>\r
241 <term>\r
242 Clone the upstream and work on it.  Feed changes to upstream.\r
243 </term>\r
244 <listitem>\r
245 <screen>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6\r
246 $ cd my2.6\r
247 $ edit/compile/test; git commit -a -s <co id="CO3-1"/>\r
248 $ git format-patch origin <co id="CO3-2"/>\r
249 $ git pull <co id="CO3-3"/>\r
250 $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <co id="CO3-4"/>\r
251 $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <co id="CO3-5"/>\r
252 $ git reset --hard ORIG_HEAD <co id="CO3-6"/>\r
253 $ git gc <co id="CO3-7"/>\r
254 $ git fetch --tags <co id="CO3-8"/></screen>\r
255 <calloutlist>\r
256 <callout arearefs="CO3-1">\r
257 <para>\r
258 repeat as needed.\r
259 </para>\r
260 </callout>\r
261 <callout arearefs="CO3-2">\r
262 <para>\r
263 extract patches from your branch for e-mail submission.\r
264 </para>\r
265 </callout>\r
266 <callout arearefs="CO3-3">\r
267 <para>\r
268 <emphasis>git pull</emphasis> fetches from <emphasis>origin</emphasis> by default and merges into the\r
269 current branch.\r
270 </para>\r
271 </callout>\r
272 <callout arearefs="CO3-4">\r
273 <para>\r
274 immediately after pulling, look at the changes done upstream\r
275 since last time we checked, only in the\r
276 area we are interested in.\r
277 </para>\r
278 </callout>\r
279 <callout arearefs="CO3-5">\r
280 <para>\r
281 fetch from a specific branch from a specific repository and merge.\r
282 </para>\r
283 </callout>\r
284 <callout arearefs="CO3-6">\r
285 <para>\r
286 revert the pull.\r
287 </para>\r
288 </callout>\r
289 <callout arearefs="CO3-7">\r
290 <para>\r
291 garbage collect leftover objects from reverted pull.\r
292 </para>\r
293 </callout>\r
294 <callout arearefs="CO3-8">\r
295 <para>\r
296 from time to time, obtain official tags from the <emphasis>origin</emphasis>\r
297 and store them under <emphasis>.git/refs/tags/</emphasis>.\r
298 </para>\r
299 </callout>\r
300 </calloutlist>\r
301 </listitem>\r
302 </varlistentry>\r
303 <varlistentry>\r
304 <term>\r
305 Push into another repository.\r
306 </term>\r
307 <listitem>\r
308 <screen>satellite$ git clone mothership:frotz frotz <co id="CO4-1"/>\r
309 satellite$ cd frotz\r
310 satellite$ git config --get-regexp '^(remote|branch)\.' <co id="CO4-2"/>\r
311 remote.origin.url mothership:frotz\r
312 remote.origin.fetch refs/heads/*:refs/remotes/origin/*\r
313 branch.master.remote origin\r
314 branch.master.merge refs/heads/master\r
315 satellite$ git config remote.origin.push \\r
316            master:refs/remotes/satellite/master <co id="CO4-3"/>\r
317 satellite$ edit/compile/test/commit\r
318 satellite$ git push origin <co id="CO4-4"/>\r
320 mothership$ cd frotz\r
321 mothership$ git checkout master\r
322 mothership$ git merge satellite/master <co id="CO4-5"/></screen>\r
323 <calloutlist>\r
324 <callout arearefs="CO4-1">\r
325 <para>\r
326 mothership machine has a frotz repository under your home\r
327 directory; clone from it to start a repository on the satellite\r
328 machine.\r
329 </para>\r
330 </callout>\r
331 <callout arearefs="CO4-2">\r
332 <para>\r
333 clone sets these configuration variables by default.\r
334 It arranges <emphasis>git pull</emphasis> to fetch and store the branches of mothership\r
335 machine to local <emphasis>remotes/origin/*</emphasis> remote-tracking branches.\r
336 </para>\r
337 </callout>\r
338 <callout arearefs="CO4-3">\r
339 <para>\r
340 arrange <emphasis>git push</emphasis> to push local <emphasis>master</emphasis> branch to\r
341 <emphasis>remotes/satellite/master</emphasis> branch of the mothership machine.\r
342 </para>\r
343 </callout>\r
344 <callout arearefs="CO4-4">\r
345 <para>\r
346 push will stash our work away on <emphasis>remotes/satellite/master</emphasis>\r
347 remote-tracking branch on the mothership machine.  You could use this\r
348 as a back-up method.\r
349 </para>\r
350 </callout>\r
351 <callout arearefs="CO4-5">\r
352 <para>\r
353 on mothership machine, merge the work done on the satellite\r
354 machine into the master branch.\r
355 </para>\r
356 </callout>\r
357 </calloutlist>\r
358 </listitem>\r
359 </varlistentry>\r
360 <varlistentry>\r
361 <term>\r
362 Branch off of a specific tag.\r
363 </term>\r
364 <listitem>\r
365 <screen>$ git checkout -b private2.6.14 v2.6.14 <co id="CO5-1"/>\r
366 $ edit/compile/test; git commit -a\r
367 $ git checkout master\r
368 $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |\r
369   git am -3 -k <co id="CO5-2"/></screen>\r
370 <calloutlist>\r
371 <callout arearefs="CO5-1">\r
372 <para>\r
373 create a private branch based on a well known (but somewhat behind)\r
374 tag.\r
375 </para>\r
376 </callout>\r
377 <callout arearefs="CO5-2">\r
378 <para>\r
379 forward port all changes in <emphasis>private2.6.14</emphasis> branch to <emphasis>master</emphasis> branch\r
380 without a formal "merging".\r
381 </para>\r
382 </callout>\r
383 </calloutlist>\r
384 </listitem>\r
385 </varlistentry>\r
386 </variablelist>\r
387 </section>\r
388 </simplesect>\r
389 <simplesect id="_integrator_anchor_id_integrator_xreflabel_integrator">\r
390 <title>Integrator<anchor id="Integrator" xreflabel="[Integrator]"/></title>\r
391 <simpara>A fairly central person acting as the integrator in a group\r
392 project receives changes made by others, reviews and integrates\r
393 them and publishes the result for others to use, using these\r
394 commands in addition to the ones needed by participants.</simpara>\r
395 <itemizedlist>\r
396 <listitem>\r
397 <simpara>\r
398 <xref linkend="git-am(1)" /> to apply patches e-mailed in from your\r
399     contributors.\r
400 </simpara>\r
401 </listitem>\r
402 <listitem>\r
403 <simpara>\r
404 <xref linkend="git-pull(1)" /> to merge from your trusted lieutenants.\r
405 </simpara>\r
406 </listitem>\r
407 <listitem>\r
408 <simpara>\r
409 <xref linkend="git-format-patch(1)" /> to prepare and send suggested\r
410     alternative to contributors.\r
411 </simpara>\r
412 </listitem>\r
413 <listitem>\r
414 <simpara>\r
415 <xref linkend="git-revert(1)" /> to undo botched commits.\r
416 </simpara>\r
417 </listitem>\r
418 <listitem>\r
419 <simpara>\r
420 <xref linkend="git-push(1)" /> to publish the bleeding edge.\r
421 </simpara>\r
422 </listitem>\r
423 </itemizedlist>\r
424 <section id="_examples_3">\r
425 <title>Examples</title>\r
426 <variablelist>\r
427 <varlistentry>\r
428 <term>\r
429 My typical GIT day.\r
430 </term>\r
431 <listitem>\r
432 <screen>$ git status <co id="CO6-1"/>\r
433 $ git show-branch <co id="CO6-2"/>\r
434 $ mailx <co id="CO6-3"/>\r
435 &amp; s 2 3 4 5 ./+to-apply\r
436 &amp; s 7 8 ./+hold-linus\r
437 &amp; q\r
438 $ git checkout -b topic/one master\r
439 $ git am -3 -i -s -u ./+to-apply <co id="CO6-4"/>\r
440 $ compile/test\r
441 $ git checkout -b hold/linus &amp;&amp; git am -3 -i -s -u ./+hold-linus <co id="CO6-5"/>\r
442 $ git checkout topic/one &amp;&amp; git rebase master <co id="CO6-6"/>\r
443 $ git checkout pu &amp;&amp; git reset --hard next <co id="CO6-7"/>\r
444 $ git merge topic/one topic/two &amp;&amp; git merge hold/linus <co id="CO6-8"/>\r
445 $ git checkout maint\r
446 $ git cherry-pick master~4 <co id="CO6-9"/>\r
447 $ compile/test\r
448 $ git tag -s -m "GIT 0.99.9x" v0.99.9x <co id="CO6-10"/>\r
449 $ git fetch ko &amp;&amp; git show-branch master maint 'tags/ko-*' <co id="CO6-11"/>\r
450 $ git push ko <co id="CO6-12"/>\r
451 $ git push ko v0.99.9x <co id="CO6-13"/></screen>\r
452 <calloutlist>\r
453 <callout arearefs="CO6-1">\r
454 <para>\r
455 see what I was in the middle of doing, if any.\r
456 </para>\r
457 </callout>\r
458 <callout arearefs="CO6-2">\r
459 <para>\r
460 see what topic branches I have and think about how ready\r
461 they are.\r
462 </para>\r
463 </callout>\r
464 <callout arearefs="CO6-3">\r
465 <para>\r
466 read mails, save ones that are applicable, and save others\r
467 that are not quite ready.\r
468 </para>\r
469 </callout>\r
470 <callout arearefs="CO6-4">\r
471 <para>\r
472 apply them, interactively, with my sign-offs.\r
473 </para>\r
474 </callout>\r
475 <callout arearefs="CO6-5">\r
476 <para>\r
477 create topic branch as needed and apply, again with my\r
478 sign-offs.\r
479 </para>\r
480 </callout>\r
481 <callout arearefs="CO6-6">\r
482 <para>\r
483 rebase internal topic branch that has not been merged to the\r
484 master, nor exposed as a part of a stable branch.\r
485 </para>\r
486 </callout>\r
487 <callout arearefs="CO6-7">\r
488 <para>\r
489 restart <emphasis>pu</emphasis> every time from the next.\r
490 </para>\r
491 </callout>\r
492 <callout arearefs="CO6-8">\r
493 <para>\r
494 and bundle topic branches still cooking.\r
495 </para>\r
496 </callout>\r
497 <callout arearefs="CO6-9">\r
498 <para>\r
499 backport a critical fix.\r
500 </para>\r
501 </callout>\r
502 <callout arearefs="CO6-10">\r
503 <para>\r
504 create a signed tag.\r
505 </para>\r
506 </callout>\r
507 <callout arearefs="CO6-11">\r
508 <para>\r
509 make sure I did not accidentally rewind master beyond what I\r
510 already pushed out.  <emphasis>ko</emphasis> shorthand points at the repository I have\r
511 at kernel.org, and looks like this:\r
512 </para>\r
513 <screen>$ cat .git/remotes/ko\r
514 URL: kernel.org:/pub/scm/git/git.git\r
515 Pull: master:refs/tags/ko-master\r
516 Pull: next:refs/tags/ko-next\r
517 Pull: maint:refs/tags/ko-maint\r
518 Push: master\r
519 Push: next\r
520 Push: +pu\r
521 Push: maint</screen>\r
522 <simpara>In the output from <emphasis>git show-branch</emphasis>, <emphasis>master</emphasis> should have\r
523 everything <emphasis>ko-master</emphasis> has, and <emphasis>next</emphasis> should have\r
524 everything <emphasis>ko-next</emphasis> has.</simpara>\r
525 </callout>\r
526 <callout arearefs="CO6-12">\r
527 <para>\r
528 push out the bleeding edge.\r
529 </para>\r
530 </callout>\r
531 <callout arearefs="CO6-13">\r
532 <para>\r
533 push the tag out, too.\r
534 </para>\r
535 </callout>\r
536 </calloutlist>\r
537 </listitem>\r
538 </varlistentry>\r
539 </variablelist>\r
540 </section>\r
541 </simplesect>\r
542 <simplesect id="_repository_administration_anchor_id_repository_administration_xreflabel_repository_administration">\r
543 <title>Repository Administration<anchor id="Repository Administration" xreflabel="[Repository Administration]"/></title>\r
544 <simpara>A repository administrator uses the following tools to set up\r
545 and maintain access to the repository by developers.</simpara>\r
546 <itemizedlist>\r
547 <listitem>\r
548 <simpara>\r
549 <xref linkend="git-daemon(1)" /> to allow anonymous download from\r
550     repository.\r
551 </simpara>\r
552 </listitem>\r
553 <listitem>\r
554 <simpara>\r
555 <xref linkend="git-shell(1)" /> can be used as a <emphasis>restricted login shell</emphasis>\r
556     for shared central repository users.\r
557 </simpara>\r
558 </listitem>\r
559 </itemizedlist>\r
560 <simpara>link:howto/update-hook-example.txt[update hook howto] has a good\r
561 example of managing a shared central repository.</simpara>\r
562 <section id="_examples_4">\r
563 <title>Examples</title>\r
564 <variablelist>\r
565 <varlistentry>\r
566 <term>\r
567 We assume the following in /etc/services\r
568 </term>\r
569 <listitem>\r
570 <screen>$ grep 9418 /etc/services\r
571 git             9418/tcp                # Git Version Control System</screen>\r
572 </listitem>\r
573 </varlistentry>\r
574 <varlistentry>\r
575 <term>\r
576 Run git-daemon to serve /pub/scm from inetd.\r
577 </term>\r
578 <listitem>\r
579 <screen>$ grep git /etc/inetd.conf\r
580 git     stream  tcp     nowait  nobody \\r
581   /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</screen>\r
582 <simpara>The actual configuration line should be on one line.</simpara>\r
583 </listitem>\r
584 </varlistentry>\r
585 <varlistentry>\r
586 <term>\r
587 Run git-daemon to serve /pub/scm from xinetd.\r
588 </term>\r
589 <listitem>\r
590 <screen>$ cat /etc/xinetd.d/git-daemon\r
591 # default: off\r
592 # description: The git server offers access to git repositories\r
593 service git\r
595         disable = no\r
596         type            = UNLISTED\r
597         port            = 9418\r
598         socket_type     = stream\r
599         wait            = no\r
600         user            = nobody\r
601         server          = /usr/bin/git-daemon\r
602         server_args     = --inetd --export-all --base-path=/pub/scm\r
603         log_on_failure  += USERID\r
604 }</screen>\r
605 <simpara>Check your xinetd(8) documentation and setup, this is from a Fedora system.\r
606 Others might be different.</simpara>\r
607 </listitem>\r
608 </varlistentry>\r
609 <varlistentry>\r
610 <term>\r
611 Give push/pull only access to developers.\r
612 </term>\r
613 <listitem>\r
614 <screen>$ grep git /etc/passwd <co id="CO7-1"/>\r
615 alice:x:1000:1000::/home/alice:/usr/bin/git-shell\r
616 bob:x:1001:1001::/home/bob:/usr/bin/git-shell\r
617 cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell\r
618 david:x:1003:1003::/home/david:/usr/bin/git-shell\r
619 $ grep git /etc/shells <co id="CO7-2"/>\r
620 /usr/bin/git-shell</screen>\r
621 <calloutlist>\r
622 <callout arearefs="CO7-1">\r
623 <para>\r
624 log-in shell is set to /usr/bin/git-shell, which does not\r
625 allow anything but <emphasis>git push</emphasis> and <emphasis>git pull</emphasis>.  The users should\r
626 get an ssh access to the machine.\r
627 </para>\r
628 </callout>\r
629 <callout arearefs="CO7-2">\r
630 <para>\r
631 in many distributions /etc/shells needs to list what is used\r
632 as the login shell.\r
633 </para>\r
634 </callout>\r
635 </calloutlist>\r
636 </listitem>\r
637 </varlistentry>\r
638 <varlistentry>\r
639 <term>\r
640 CVS-style shared repository.\r
641 </term>\r
642 <listitem>\r
643 <screen>$ grep git /etc/group <co id="CO8-1"/>\r
644 git:x:9418:alice,bob,cindy,david\r
645 $ cd /home/devo.git\r
646 $ ls -l <co id="CO8-2"/>\r
647   lrwxrwxrwx   1 david git    17 Dec  4 22:40 HEAD -&gt; refs/heads/master\r
648   drwxrwsr-x   2 david git  4096 Dec  4 22:40 branches\r
649   -rw-rw-r--   1 david git    84 Dec  4 22:40 config\r
650   -rw-rw-r--   1 david git    58 Dec  4 22:40 description\r
651   drwxrwsr-x   2 david git  4096 Dec  4 22:40 hooks\r
652   -rw-rw-r--   1 david git 37504 Dec  4 22:40 index\r
653   drwxrwsr-x   2 david git  4096 Dec  4 22:40 info\r
654   drwxrwsr-x   4 david git  4096 Dec  4 22:40 objects\r
655   drwxrwsr-x   4 david git  4096 Nov  7 14:58 refs\r
656   drwxrwsr-x   2 david git  4096 Dec  4 22:40 remotes\r
657 $ ls -l hooks/update <co id="CO8-3"/>\r
658   -r-xr-xr-x   1 david git  3536 Dec  4 22:40 update\r
659 $ cat info/allowed-users <co id="CO8-4"/>\r
660 refs/heads/master       alice\|cindy\r
661 refs/heads/doc-update   bob\r
662 refs/tags/v[0-9]*       david</screen>\r
663 <calloutlist>\r
664 <callout arearefs="CO8-1">\r
665 <para>\r
666 place the developers into the same git group.\r
667 </para>\r
668 </callout>\r
669 <callout arearefs="CO8-2">\r
670 <para>\r
671 and make the shared repository writable by the group.\r
672 </para>\r
673 </callout>\r
674 <callout arearefs="CO8-3">\r
675 <para>\r
676 use update-hook example by Carl from Documentation/howto/\r
677 for branch policy control.\r
678 </para>\r
679 </callout>\r
680 <callout arearefs="CO8-4">\r
681 <para>\r
682 alice and cindy can push into master, only bob can push into doc-update.\r
683 david is the release manager and is the only person who can\r
684 create and push version tags.\r
685 </para>\r
686 </callout>\r
687 </calloutlist>\r
688 </listitem>\r
689 </varlistentry>\r
690 <varlistentry>\r
691 <term>\r
692 HTTP server to support dumb protocol transfer.\r
693 </term>\r
694 <listitem>\r
695 <screen>dev$ git update-server-info <co id="CO9-1"/>\r
696 dev$ ftp user@isp.example.com <co id="CO9-2"/>\r
697 ftp&gt; cp -r .git /home/user/myproject.git</screen>\r
698 <calloutlist>\r
699 <callout arearefs="CO9-1">\r
700 <para>\r
701 make sure your info/refs and objects/info/packs are up-to-date\r
702 </para>\r
703 </callout>\r
704 <callout arearefs="CO9-2">\r
705 <para>\r
706 upload to public HTTP server hosted by your ISP.\r
707 </para>\r
708 </callout>\r
709 </calloutlist>\r
710 </listitem>\r
711 </varlistentry>\r
712 </variablelist>\r
713 </section>\r
714 </simplesect>\r
715 </article>\r