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