OSDN Git Service

Add Git official document to help
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / everyday.xml
diff --git a/doc/source/en/TortoiseGit/git_doc/everyday.xml b/doc/source/en/TortoiseGit/git_doc/everyday.xml
new file mode 100644 (file)
index 0000000..d36bc2e
--- /dev/null
@@ -0,0 +1,787 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
+\r
+<article lang="en" id="Everyday GIT With 20 Commands Or So">\r
+<articleinfo>\r
+    <title>Everyday GIT With 20 Commands Or So</title>\r
+        <indexterm>\r
+                <primary>Everyday GIT With 20 Commands Or So</primary>\r
+        </indexterm>\r
+</articleinfo>\r
+<simpara><xref linkend="Basic Repository"/> commands are needed by people who have a\r
+repository --- that is everybody, because every working tree of\r
+git is a repository.</simpara>\r
+<simpara>In addition, <xref linkend="Individual Developer (Standalone)"/> commands are\r
+essential for anybody who makes a commit, even for somebody who\r
+works alone.</simpara>\r
+<simpara>If you work with other people, you will need commands listed in\r
+the <xref linkend="Individual Developer (Participant)"/> section as well.</simpara>\r
+<simpara>People who play the <xref linkend="Integrator"/> role need to learn some more\r
+commands in addition to the above.</simpara>\r
+<simpara><xref linkend="Repository Administration"/> commands are for system\r
+administrators who are responsible for the care and feeding\r
+of git repositories.</simpara>\r
+<simplesect id="_basic_repository_anchor_id_basic_repository_xreflabel_basic_repository">\r
+<title>Basic Repository<anchor id="Basic Repository" xreflabel="[Basic Repository]"/></title>\r
+<simpara>Everybody uses these commands to maintain git repositories.</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-init(1)"/> or <xref linkend="git-clone(1)"/> to create a\r
+    new repository.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-fsck(1)"/> to check the repository for errors.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-gc(1)"/> to do common housekeeping tasks such as\r
+    repack and prune.\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simplesect id="_examples">\r
+<title>Examples</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+Check health and remove cruft.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git fsck <co id="CO1-1"/>\r
+$ git count-objects <co id="CO1-2"/>\r
+$ git gc <co id="CO1-3"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO1-1">\r
+<simpara>\r
+running without <literal>--full</literal> is usually cheap and assures the\r
+repository health reasonably well.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO1-2">\r
+<simpara>\r
+check how many loose objects there are and how much\r
+disk space is wasted by not repacking.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO1-3">\r
+<simpara>\r
+repacks the local repository and performs other housekeeping tasks.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Repack a small project into single pack.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git gc <co id="CO2-1"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO2-1">\r
+<simpara>\r
+pack all the objects reachable from the refs into one pack,\r
+then remove the other packs.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+</simplesect>\r
+<simplesect id="_individual_developer_standalone_anchor_id_individual_developer_standalone_xreflabel_individual_developer_standalone">\r
+<title>Individual Developer (Standalone)<anchor id="Individual Developer (Standalone)" xreflabel="[Individual Developer (Standalone)]"/></title>\r
+<simpara>A standalone individual developer does not exchange patches with\r
+other people, and works alone in a single repository, using the\r
+following commands.</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-show-branch(1)"/> to see where you are.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-log(1)"/> to see what happened.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-checkout(1)"/> and <xref linkend="git-branch(1)"/> to switch\r
+    branches.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-add(1)"/> to manage the index file.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-diff(1)"/> and <xref linkend="git-status(1)"/> to see what\r
+    you are in the middle of doing.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-commit(1)"/> to advance the current branch.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-reset(1)"/> and <xref linkend="git-checkout(1)"/> (with\r
+    pathname parameters) to undo changes.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-merge(1)"/> to merge between local branches.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-rebase(1)"/> to maintain topic branches.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-tag(1)"/> to mark known point.\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simplesect id="_examples_2">\r
+<title>Examples</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+Use a tarball as a starting point for a new repository.\r
+</term>\r
+<listitem>\r
+<literallayout>$ tar zxf frotz.tar.gz\r
+$ cd frotz\r
+$ git-init\r
+$ git add . <co id="CO3-1"/>\r
+$ git commit -m "import of frotz source tree."\r
+$ git tag v2.43 <co id="CO3-2"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO3-1">\r
+<simpara>\r
+add everything under the current directory.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO3-2">\r
+<simpara>\r
+make a lightweight, unannotated tag.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Create a topic branch and develop.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git checkout -b alsa-audio <co id="CO4-1"/>\r
+$ edit/compile/test\r
+$ git checkout -- curses/ux_audio_oss.c <co id="CO4-2"/>\r
+$ git add curses/ux_audio_alsa.c <co id="CO4-3"/>\r
+$ edit/compile/test\r
+$ git diff HEAD <co id="CO4-4"/>\r
+$ git commit -a -s <co id="CO4-5"/>\r
+$ edit/compile/test\r
+$ git reset --soft HEAD^ <co id="CO4-6"/>\r
+$ edit/compile/test\r
+$ git diff ORIG_HEAD <co id="CO4-7"/>\r
+$ git commit -a -c ORIG_HEAD <co id="CO4-8"/>\r
+$ git checkout master <co id="CO4-9"/>\r
+$ git merge alsa-audio <co id="CO4-10"/>\r
+$ git log --since='3 days ago' <co id="CO4-11"/>\r
+$ git log v2.43.. curses/ <co id="CO4-12"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO4-1">\r
+<simpara>\r
+create a new topic branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-2">\r
+<simpara>\r
+revert your botched changes in <literal>curses/ux_audio_oss.c</literal>.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-3">\r
+<simpara>\r
+you need to tell git if you added a new file; removal and\r
+modification will be caught if you do <literal>git commit -a</literal> later.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-4">\r
+<simpara>\r
+to see what changes you are committing.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-5">\r
+<simpara>\r
+commit everything as you have tested, with your sign-off.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-6">\r
+<simpara>\r
+take the last commit back, keeping what is in the working tree.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-7">\r
+<simpara>\r
+look at the changes since the premature commit we took back.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-8">\r
+<simpara>\r
+redo the commit undone in the previous step, using the message\r
+you originally wrote.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-9">\r
+<simpara>\r
+switch to the master branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-10">\r
+<simpara>\r
+merge a topic branch into your master branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-11">\r
+<simpara>\r
+review commit logs; other forms to limit output can be\r
+combined and include <literal>--max-count=10</literal> (show 10 commits),\r
+<literal>--until=2005-12-10</literal>, etc.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO4-12">\r
+<simpara>\r
+view only the changes that touch what&#8217;s in <literal>curses/</literal>\r
+directory, since <literal>v2.43</literal> tag.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+</simplesect>\r
+<simplesect id="_individual_developer_participant_anchor_id_individual_developer_participant_xreflabel_individual_developer_participant">\r
+<title>Individual Developer (Participant)<anchor id="Individual Developer (Participant)" xreflabel="[Individual Developer (Participant)]"/></title>\r
+<simpara>A developer working as a participant in a group project needs to\r
+learn how to communicate with others, and uses these commands in\r
+addition to the ones needed by a standalone developer.</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-clone(1)"/> from the upstream to prime your local\r
+    repository.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-pull(1)"/> and <xref linkend="git-fetch(1)"/> from "origin"\r
+    to keep up-to-date with the upstream.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-push(1)"/> to shared repository, if you adopt CVS\r
+    style shared repository workflow.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-format-patch(1)"/> to prepare e-mail submission, if\r
+    you adopt Linux kernel-style public forum workflow.\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simplesect id="_examples_3">\r
+<title>Examples</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+Clone the upstream and work on it.  Feed changes to upstream.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6\r
+$ cd my2.6\r
+$ edit/compile/test; git commit -a -s <co id="CO5-1"/>\r
+$ git format-patch origin <co id="CO5-2"/>\r
+$ git pull <co id="CO5-3"/>\r
+$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <co id="CO5-4"/>\r
+$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <co id="CO5-5"/>\r
+$ git reset --hard ORIG_HEAD <co id="CO5-6"/>\r
+$ git gc <co id="CO5-7"/>\r
+$ git fetch --tags <co id="CO5-8"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO5-1">\r
+<simpara>\r
+repeat as needed.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-2">\r
+<simpara>\r
+extract patches from your branch for e-mail submission.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-3">\r
+<simpara>\r
+<literal>git pull</literal> fetches from <literal>origin</literal> by default and merges into the\r
+current branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-4">\r
+<simpara>\r
+immediately after pulling, look at the changes done upstream\r
+since last time we checked, only in the\r
+area we are interested in.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-5">\r
+<simpara>\r
+fetch from a specific branch from a specific repository and merge.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-6">\r
+<simpara>\r
+revert the pull.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-7">\r
+<simpara>\r
+garbage collect leftover objects from reverted pull.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO5-8">\r
+<simpara>\r
+from time to time, obtain official tags from the <literal>origin</literal>\r
+and store them under <literal>.git/refs/tags/</literal>.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Push into another repository.\r
+</term>\r
+<listitem>\r
+<literallayout>satellite$ git clone mothership:frotz frotz <co id="CO6-1"/>\r
+satellite$ cd frotz\r
+satellite$ git config --get-regexp '^(remote|branch)\.' <co id="CO6-2"/>\r
+remote.origin.url mothership:frotz\r
+remote.origin.fetch refs/heads/*:refs/remotes/origin/*\r
+branch.master.remote origin\r
+branch.master.merge refs/heads/master\r
+satellite$ git config remote.origin.push \\r
+           master:refs/remotes/satellite/master <co id="CO6-3"/>\r
+satellite$ edit/compile/test/commit\r
+satellite$ git push origin <co id="CO6-4"/>\r
+\r
+mothership$ cd frotz\r
+mothership$ git checkout master\r
+mothership$ git merge satellite/master <co id="CO6-5"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO6-1">\r
+<simpara>\r
+mothership machine has a frotz repository under your home\r
+directory; clone from it to start a repository on the satellite\r
+machine.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO6-2">\r
+<simpara>\r
+clone sets these configuration variables by default.\r
+It arranges <literal>git pull</literal> to fetch and store the branches of mothership\r
+machine to local <literal>remotes/origin/*</literal> tracking branches.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO6-3">\r
+<simpara>\r
+arrange <literal>git push</literal> to push local <literal>master</literal> branch to\r
+<literal>remotes/satellite/master</literal> branch of the mothership machine.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO6-4">\r
+<simpara>\r
+push will stash our work away on <literal>remotes/satellite/master</literal>\r
+tracking branch on the mothership machine.  You could use this as\r
+a back-up method.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO6-5">\r
+<simpara>\r
+on mothership machine, merge the work done on the satellite\r
+machine into the master branch.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Branch off of a specific tag.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git checkout -b private2.6.14 v2.6.14 <co id="CO7-1"/>\r
+$ edit/compile/test; git commit -a\r
+$ git checkout master\r
+$ git format-patch -k -m --stdout v2.6.14..private2.6.14 |\r
+  git am -3 -k <co id="CO7-2"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO7-1">\r
+<simpara>\r
+create a private branch based on a well known (but somewhat behind)\r
+tag.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO7-2">\r
+<simpara>\r
+forward port all changes in <literal>private2.6.14</literal> branch to <literal>master</literal> branch\r
+without a formal "merging".\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+</simplesect>\r
+<simplesect id="_integrator_anchor_id_integrator_xreflabel_integrator">\r
+<title>Integrator<anchor id="Integrator" xreflabel="[Integrator]"/></title>\r
+<simpara>A fairly central person acting as the integrator in a group\r
+project receives changes made by others, reviews and integrates\r
+them and publishes the result for others to use, using these\r
+commands in addition to the ones needed by participants.</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-am(1)"/> to apply patches e-mailed in from your\r
+    contributors.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-pull(1)"/> to merge from your trusted lieutenants.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-format-patch(1)"/> to prepare and send suggested\r
+    alternative to contributors.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-revert(1)"/> to undo botched commits.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-push(1)"/> to publish the bleeding edge.\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simplesect id="_examples_4">\r
+<title>Examples</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+My typical GIT day.\r
+</term>\r
+<listitem>\r
+<literallayout>$ git status <co id="CO8-1"/>\r
+$ git show-branch <co id="CO8-2"/>\r
+$ mailx <co id="CO8-3"/>\r
+&amp; s 2 3 4 5 ./+to-apply\r
+&amp; s 7 8 ./+hold-linus\r
+&amp; q\r
+$ git checkout -b topic/one master\r
+$ git am -3 -i -s -u ./+to-apply <co id="CO8-4"/>\r
+$ compile/test\r
+$ git checkout -b hold/linus &amp;&amp; git am -3 -i -s -u ./+hold-linus <co id="CO8-5"/>\r
+$ git checkout topic/one &amp;&amp; git rebase master <co id="CO8-6"/>\r
+$ git checkout pu &amp;&amp; git reset --hard next <co id="CO8-7"/>\r
+$ git merge topic/one topic/two &amp;&amp; git merge hold/linus <co id="CO8-8"/>\r
+$ git checkout maint\r
+$ git cherry-pick master~4 <co id="CO8-9"/>\r
+$ compile/test\r
+$ git tag -s -m "GIT 0.99.9x" v0.99.9x <co id="CO8-10"/>\r
+$ git fetch ko &amp;&amp; git show-branch master maint 'tags/ko-*' <co id="CO8-11"/>\r
+$ git push ko <co id="CO8-12"/>\r
+$ git push ko v0.99.9x <co id="CO8-13"/></literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO8-1">\r
+<simpara>\r
+see what I was in the middle of doing, if any.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-2">\r
+<simpara>\r
+see what topic branches I have and think about how ready\r
+they are.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-3">\r
+<simpara>\r
+read mails, save ones that are applicable, and save others\r
+that are not quite ready.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-4">\r
+<simpara>\r
+apply them, interactively, with my sign-offs.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-5">\r
+<simpara>\r
+create topic branch as needed and apply, again with my\r
+sign-offs.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-6">\r
+<simpara>\r
+rebase internal topic branch that has not been merged to the\r
+master, nor exposed as a part of a stable branch.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-7">\r
+<simpara>\r
+restart <literal>pu</literal> every time from the next.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-8">\r
+<simpara>\r
+and bundle topic branches still cooking.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-9">\r
+<simpara>\r
+backport a critical fix.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-10">\r
+<simpara>\r
+create a signed tag.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-11">\r
+<simpara>\r
+make sure I did not accidentally rewind master beyond what I\r
+already pushed out.  <literal>ko</literal> shorthand points at the repository I have\r
+at kernel.org, and looks like this:\r
+</simpara>\r
+<literallayout>$ cat .git/remotes/ko\r
+URL: kernel.org:/pub/scm/git/git.git\r
+Pull: master:refs/tags/ko-master\r
+Pull: next:refs/tags/ko-next\r
+Pull: maint:refs/tags/ko-maint\r
+Push: master\r
+Push: next\r
+Push: +pu\r
+Push: maint</literallayout>\r
+<simpara>In the output from <literal>git show-branch</literal>, <literal>master</literal> should have\r
+everything <literal>ko-master</literal> has, and <literal>next</literal> should have\r
+everything <literal>ko-next</literal> has.</simpara>\r
+</callout>\r
+<callout arearefs="CO8-12">\r
+<simpara>\r
+push out the bleeding edge.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO8-13">\r
+<simpara>\r
+push the tag out, too.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+</simplesect>\r
+<simplesect id="_repository_administration_anchor_id_repository_administration_xreflabel_repository_administration">\r
+<title>Repository Administration<anchor id="Repository Administration" xreflabel="[Repository Administration]"/></title>\r
+<simpara>A repository administrator uses the following tools to set up\r
+and maintain access to the repository by developers.</simpara>\r
+<itemizedlist>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-daemon(1)"/> to allow anonymous download from\r
+    repository.\r
+</simpara>\r
+</listitem>\r
+<listitem>\r
+<simpara>\r
+<xref linkend="git-shell(1)"/> can be used as a <emphasis>restricted login shell</emphasis>\r
+    for shared central repository users.\r
+</simpara>\r
+</listitem>\r
+</itemizedlist>\r
+<simpara><ulink url="howto/update-hook-example.txt">update hook howto</ulink> has a good\r
+example of managing a shared central repository.</simpara>\r
+<simplesect id="_examples_5">\r
+<title>Examples</title>\r
+<variablelist>\r
+<varlistentry>\r
+<term>\r
+We assume the following in /etc/services\r
+</term>\r
+<listitem>\r
+<literallayout>$ grep 9418 /etc/services\r
+git             9418/tcp                # Git Version Control System</literallayout>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Run git-daemon to serve /pub/scm from inetd.\r
+</term>\r
+<listitem>\r
+<literallayout>$ grep git /etc/inetd.conf\r
+git     stream  tcp     nowait  nobody \\r
+  /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</literallayout>\r
+<simpara>The actual configuration line should be on one line.</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Run git-daemon to serve /pub/scm from xinetd.\r
+</term>\r
+<listitem>\r
+<literallayout>$ cat /etc/xinetd.d/git-daemon\r
+# default: off\r
+# description: The git server offers access to git repositories\r
+service git\r
+{\r
+        disable = no\r
+        type            = UNLISTED\r
+        port            = 9418\r
+        socket_type     = stream\r
+        wait            = no\r
+        user            = nobody\r
+        server          = /usr/bin/git-daemon\r
+        server_args     = --inetd --export-all --base-path=/pub/scm\r
+        log_on_failure  += USERID\r
+}</literallayout>\r
+<simpara>Check your xinetd(8) documentation and setup, this is from a Fedora system.\r
+Others might be different.</simpara>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+Give push/pull only access to developers.\r
+</term>\r
+<listitem>\r
+<literallayout>$ grep git /etc/passwd <co id="CO9-1"/>\r
+alice:x:1000:1000::/home/alice:/usr/bin/git-shell\r
+bob:x:1001:1001::/home/bob:/usr/bin/git-shell\r
+cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell\r
+david:x:1003:1003::/home/david:/usr/bin/git-shell\r
+$ grep git /etc/shells <co id="CO9-2"/>\r
+/usr/bin/git-shell</literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO9-1">\r
+<simpara>\r
+log-in shell is set to /usr/bin/git-shell, which does not\r
+allow anything but <literal>git push</literal> and <literal>git pull</literal>.  The users should\r
+get an ssh access to the machine.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO9-2">\r
+<simpara>\r
+in many distributions /etc/shells needs to list what is used\r
+as the login shell.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+CVS-style shared repository.\r
+</term>\r
+<listitem>\r
+<literallayout>$ grep git /etc/group <co id="CO10-1"/>\r
+git:x:9418:alice,bob,cindy,david\r
+$ cd /home/devo.git\r
+$ ls -l <co id="CO10-2"/>\r
+  lrwxrwxrwx   1 david git    17 Dec  4 22:40 HEAD -&gt; refs/heads/master\r
+  drwxrwsr-x   2 david git  4096 Dec  4 22:40 branches\r
+  -rw-rw-r--   1 david git    84 Dec  4 22:40 config\r
+  -rw-rw-r--   1 david git    58 Dec  4 22:40 description\r
+  drwxrwsr-x   2 david git  4096 Dec  4 22:40 hooks\r
+  -rw-rw-r--   1 david git 37504 Dec  4 22:40 index\r
+  drwxrwsr-x   2 david git  4096 Dec  4 22:40 info\r
+  drwxrwsr-x   4 david git  4096 Dec  4 22:40 objects\r
+  drwxrwsr-x   4 david git  4096 Nov  7 14:58 refs\r
+  drwxrwsr-x   2 david git  4096 Dec  4 22:40 remotes\r
+$ ls -l hooks/update <co id="CO10-3"/>\r
+  -r-xr-xr-x   1 david git  3536 Dec  4 22:40 update\r
+$ cat info/allowed-users <co id="CO10-4"/>\r
+refs/heads/master       alice\|cindy\r
+refs/heads/doc-update   bob\r
+refs/tags/v[0-9]*       david</literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO10-1">\r
+<simpara>\r
+place the developers into the same git group.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO10-2">\r
+<simpara>\r
+and make the shared repository writable by the group.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO10-3">\r
+<simpara>\r
+use update-hook example by Carl from Documentation/howto/\r
+for branch policy control.\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO10-4">\r
+<simpara>\r
+alice and cindy can push into master, only bob can push into doc-update.\r
+david is the release manager and is the only person who can\r
+create and push version tags.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+<varlistentry>\r
+<term>\r
+HTTP server to support dumb protocol transfer.\r
+</term>\r
+<listitem>\r
+<literallayout>dev$ git update-server-info <co id="CO11-1"/>\r
+dev$ ftp user@isp.example.com <co id="CO11-2"/>\r
+ftp&gt; cp -r .git /home/user/myproject.git</literallayout>\r
+<calloutlist>\r
+<callout arearefs="CO11-1">\r
+<simpara>\r
+make sure your info/refs and objects/info/packs are up-to-date\r
+</simpara>\r
+</callout>\r
+<callout arearefs="CO11-2">\r
+<simpara>\r
+upload to public HTTP server hosted by your ISP.\r
+</simpara>\r
+</callout>\r
+</calloutlist>\r
+</listitem>\r
+</varlistentry>\r
+</variablelist>\r
+</simplesect>\r
+</simplesect>\r
+</article>\r