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