986 lines
21 KiB
HTML
986 lines
21 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GITEVERYDAY</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GITEVERYDAY</H1>
|
|
Section: Git Manual (7)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
giteveryday - A useful minimum set of commands for Everyday Git
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
Everyday Git With 20 Commands Or So
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
Git users can broadly be grouped into four categories for the purposes of describing here a small set of useful command for everyday Git.
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
•
|
|
|
|
|
|
Individual Developer (Standalone)
|
|
commands are essential for anybody who makes a commit, even for somebody who works alone.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
•
|
|
|
|
|
|
If you work with other people, you will need commands listed in the
|
|
Individual Developer (Participant)
|
|
section as well.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
•
|
|
|
|
|
|
People who play the
|
|
Integrator
|
|
role need to learn some more commands in addition to the above.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
•
|
|
|
|
|
|
Repository Administration
|
|
commands are for system administrators who are responsible for the care and feeding of Git repositories.
|
|
</DL>
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>INDIVIDUAL DEVELOPER (STANDALONE)</H2>
|
|
|
|
<P>
|
|
A standalone individual developer does not exchange patches with other people, and works alone in a single repository, using the following commands.
|
|
<P>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-init">git-init</A></B>(1)
|
|
to create a new repository.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-log">git-log</A></B>(1)
|
|
to see what happened.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-switch">git-switch</A></B>(1)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-branch">git-branch</A></B>(1)
|
|
to switch branches.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-add">git-add</A></B>(1)
|
|
to manage the index file.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-diff">git-diff</A></B>(1)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-status">git-status</A></B>(1)
|
|
to see what you are in the middle of doing.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-commit">git-commit</A></B>(1)
|
|
to advance the current branch.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-restore">git-restore</A></B>(1)
|
|
to undo changes.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-merge">git-merge</A></B>(1)
|
|
to merge between local branches.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-rebase">git-rebase</A></B>(1)
|
|
to maintain topic branches.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-tag">git-tag</A></B>(1)
|
|
to mark a known point.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Examples</H3>
|
|
|
|
<P>
|
|
|
|
Use a tarball as a starting point for a new repository.
|
|
<DL COMPACT><DT id="15"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ tar zxf frotz.tar.gz
|
|
$ cd frotz
|
|
$ git init
|
|
$ git add . <B>(1)</B>
|
|
$ git commit -m "import of frotz source tree."
|
|
$ git tag v2.43 <B>(2)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>add everything under the current directory.
|
|
<BR>
|
|
|
|
<B>2. </B>make a lightweight, unannotated tag.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Create a topic branch and develop.
|
|
<DL COMPACT><DT id="17"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ git switch -c alsa-audio <B>(1)</B>
|
|
$ edit/compile/test
|
|
$ git restore curses/ux_audio_oss.c <B>(2)</B>
|
|
$ git add curses/ux_audio_alsa.c <B>(3)</B>
|
|
$ edit/compile/test
|
|
$ git diff HEAD <B>(4)</B>
|
|
$ git commit -a -s <B>(5)</B>
|
|
$ edit/compile/test
|
|
$ git diff HEAD^ <B>(6)</B>
|
|
$ git commit -a --amend <B>(7)</B>
|
|
$ git switch master <B>(8)</B>
|
|
$ git merge alsa-audio <B>(9)</B>
|
|
$ git log --since='3 days ago' <B>(10)</B>
|
|
$ git log v2.43.. curses/ <B>(11)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>create a new topic branch.
|
|
<BR>
|
|
|
|
<B>2. </B>revert your botched changes in
|
|
<B>curses/ux_audio_oss.c</B>.
|
|
<BR>
|
|
|
|
<B>3. </B>you need to tell Git if you added a new file; removal and modification will be caught if you do
|
|
<B>git commit -a</B>
|
|
later.
|
|
<BR>
|
|
|
|
<B>4. </B>to see what changes you are committing.
|
|
<BR>
|
|
|
|
<B>5. </B>commit everything, as you have tested, with your sign-off.
|
|
<BR>
|
|
|
|
<B>6. </B>look at all your changes including the previous commit.
|
|
<BR>
|
|
|
|
<B>7. </B>amend the previous commit, adding all your new changes, using your original message.
|
|
<BR>
|
|
|
|
<B>8. </B>switch to the master branch.
|
|
<BR>
|
|
|
|
<B>9. </B>merge a topic branch into your master branch.
|
|
<BR>
|
|
|
|
<B>10. </B>review commit logs; other forms to limit output can be combined and include
|
|
<B>-10</B>
|
|
(to show up to 10 commits),
|
|
<B>--until=2005-12-10</B>, etc.
|
|
<BR>
|
|
|
|
<B>11. </B>view only the changes that touch what's in
|
|
<B>curses/</B>
|
|
directory, since
|
|
<B>v2.43</B>
|
|
tag.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>INDIVIDUAL DEVELOPER (PARTICIPANT)</H2>
|
|
|
|
<P>
|
|
A developer working as a participant in a group project needs to learn how to communicate with others, and uses these commands in addition to the ones needed by a standalone developer.
|
|
<P>
|
|
<DL COMPACT><DT id="19"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-clone">git-clone</A></B>(1)
|
|
from the upstream to prime your local repository.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="20"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-pull">git-pull</A></B>(1)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-fetch">git-fetch</A></B>(1)
|
|
from "origin" to keep up-to-date with the upstream.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="21"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-push">git-push</A></B>(1)
|
|
to shared repository, if you adopt CVS style shared repository workflow.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-format-patch">git-format-patch</A></B>(1)
|
|
to prepare e-mail submission, if you adopt Linux kernel-style public forum workflow.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-send-email">git-send-email</A></B>(1)
|
|
to send your e-mail submission without corruption by your MUA.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="24"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-request-pull">git-request-pull</A></B>(1)
|
|
to create a summary of changes for your upstream to pull.
|
|
</DL>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Examples</H3>
|
|
|
|
<P>
|
|
|
|
Clone the upstream and work on it. Feed changes to upstream.
|
|
<DL COMPACT><DT id="25"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="26"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ git clone <A HREF="git://git.kernel.org/pub/scm/.../torvalds/linux-2.6">git://git.kernel.org/pub/scm/.../torvalds/linux-2.6</A> my2.6
|
|
$ cd my2.6
|
|
$ git switch -c mine master <B>(1)</B>
|
|
$ edit/compile/test; git commit -a -s <B>(2)</B>
|
|
$ git format-patch master <B>(3)</B>
|
|
$ git send-email --to="person <<A HREF="mailto:email@example.com">email@example.com</A>>" 00*.patch <B>(4)</B>
|
|
$ git switch master <B>(5)</B>
|
|
$ git pull <B>(6)</B>
|
|
$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <B>(7)</B>
|
|
$ git ls-remote --heads <A HREF="http://git.kernel.org/.../jgarzik/libata-dev.git">http://git.kernel.org/.../jgarzik/libata-dev.git</A> <B>(8)</B>
|
|
$ git pull <A HREF="git://git.kernel.org/pub/.../jgarzik/libata-dev.git">git://git.kernel.org/pub/.../jgarzik/libata-dev.git</A> ALL <B>(9)</B>
|
|
$ git reset --hard ORIG_HEAD <B>(10)</B>
|
|
$ git gc <B>(11)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>checkout a new branch
|
|
<B>mine</B>
|
|
from master.
|
|
<BR>
|
|
|
|
<B>2. </B>repeat as needed.
|
|
<BR>
|
|
|
|
<B>3. </B>extract patches from your branch, relative to master,
|
|
<BR>
|
|
|
|
<B>4. </B>and email them.
|
|
<BR>
|
|
|
|
<B>5. </B>return to
|
|
<B>master</B>, ready to see what's new
|
|
<BR>
|
|
|
|
<B>6. </B><B>git pull</B>
|
|
fetches from
|
|
<B>origin</B>
|
|
by default and merges into the current branch.
|
|
<BR>
|
|
|
|
<B>7. </B>immediately after pulling, look at the changes done upstream since last time we checked, only in the area we are interested in.
|
|
<BR>
|
|
|
|
<B>8. </B>check the branch names in an external repository (if not known).
|
|
<BR>
|
|
|
|
<B>9. </B>fetch from a specific branch
|
|
<B>ALL</B>
|
|
from a specific repository and merge it.
|
|
<BR>
|
|
|
|
<B>10. </B>revert the pull.
|
|
<BR>
|
|
|
|
<B>11. </B>garbage collect leftover objects from reverted pull.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Push into another repository.
|
|
<DL COMPACT><DT id="27"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="28"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
satellite$ git clone mothership:frotz frotz <B>(1)</B>
|
|
satellite$ cd frotz
|
|
satellite$ git config --get-regexp '^(remote|branch)\.' <B>(2)</B>
|
|
remote.origin.url mothership:frotz
|
|
remote.origin.fetch refs/heads/*:refs/remotes/origin/*
|
|
branch.master.remote origin
|
|
branch.master.merge refs/heads/master
|
|
satellite$ git config remote.origin.push \
|
|
+refs/heads/*:refs/remotes/satellite/* <B>(3)</B>
|
|
satellite$ edit/compile/test/commit
|
|
satellite$ git push origin <B>(4)</B>
|
|
|
|
mothership$ cd frotz
|
|
mothership$ git switch master
|
|
mothership$ git merge satellite/master <B>(5)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>mothership machine has a frotz repository under your home directory; clone from it to start a repository on the satellite machine.
|
|
<BR>
|
|
|
|
<B>2. </B>clone sets these configuration variables by default. It arranges
|
|
<B>git pull</B>
|
|
to fetch and store the branches of mothership machine to local
|
|
<B>remotes/origin/*</B>
|
|
remote-tracking branches.
|
|
<BR>
|
|
|
|
<B>3. </B>arrange
|
|
<B>git push</B>
|
|
to push all local branches to their corresponding branch of the mothership machine.
|
|
<BR>
|
|
|
|
<B>4. </B>push will stash all our work away on
|
|
<B>remotes/satellite/*</B>
|
|
remote-tracking branches on the mothership machine. You could use this as a back-up method. Likewise, you can pretend that mothership "fetched" from you (useful when access is one sided).
|
|
<BR>
|
|
|
|
<B>5. </B>on mothership machine, merge the work done on the satellite machine into the master branch.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Branch off of a specific tag.
|
|
<DL COMPACT><DT id="29"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="30"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ git switch -c private2.6.14 v2.6.14 <B>(1)</B>
|
|
$ edit/compile/test; git commit -a
|
|
$ git checkout master
|
|
$ git cherry-pick v2.6.14..private2.6.14 <B>(2)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>create a private branch based on a well known (but somewhat behind) tag.
|
|
<BR>
|
|
|
|
<B>2. </B>forward port all changes in
|
|
<B>private2.6.14</B>
|
|
branch to
|
|
<B>master</B>
|
|
branch without a formal "merging". Or longhand
|
|
<P>
|
|
<B>git format-patch -k -m --stdout v2.6.14..private2.6.14 | git am -3 -k</B>
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
An alternate participant submission mechanism is using the <B>git request-pull</B> or pull-request mechanisms (e.g as used on GitHub (<A HREF="http://www.github.com">www.github.com</A>) to notify your upstream of your contribution.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>INTEGRATOR</H2>
|
|
|
|
<P>
|
|
A fairly central person acting as the integrator in a group project receives changes made by others, reviews and integrates them and publishes the result for others to use, using these commands in addition to the ones needed by participants.
|
|
<P>
|
|
This section can also be used by those who respond to <B>git request-pull</B> or pull-request on GitHub (<A HREF="http://www.github.com">www.github.com</A>) to integrate the work of others into their history. A sub-area lieutenant for a repository will act both as a participant and as an integrator.
|
|
<P>
|
|
<DL COMPACT><DT id="31"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-am">git-am</A></B>(1)
|
|
to apply patches e-mailed in from your contributors.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="32"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-pull">git-pull</A></B>(1)
|
|
to merge from your trusted lieutenants.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="33"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-format-patch">git-format-patch</A></B>(1)
|
|
to prepare and send suggested alternative to contributors.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="34"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-revert">git-revert</A></B>(1)
|
|
to undo botched commits.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="35"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-push">git-push</A></B>(1)
|
|
to publish the bleeding edge.
|
|
</DL>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Examples</H3>
|
|
|
|
<P>
|
|
|
|
A typical integrator's Git day.
|
|
<DL COMPACT><DT id="36"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="37"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ git status <B>(1)</B>
|
|
$ git branch --no-merged master <B>(2)</B>
|
|
$ mailx <B>(3)</B>
|
|
& s 2 3 4 5 ./+to-apply
|
|
& s 7 8 ./+hold-linus
|
|
& q
|
|
$ git switch -c topic/one master
|
|
$ git am -3 -i -s ./+to-apply <B>(4)</B>
|
|
$ compile/test
|
|
$ git switch -c hold/linus && git am -3 -i -s ./+hold-linus <B>(5)</B>
|
|
$ git switch topic/one && git rebase master <B>(6)</B>
|
|
$ git switch -C pu next <B>(7)</B>
|
|
$ git merge topic/one topic/two && git merge hold/linus <B>(8)</B>
|
|
$ git switch maint
|
|
$ git cherry-pick master~4 <B>(9)</B>
|
|
$ compile/test
|
|
$ git tag -s -m "GIT 0.99.9x" v0.99.9x <B>(10)</B>
|
|
$ git fetch ko && for branch in master maint next pu <B>(11)</B>
|
|
do
|
|
git show-branch ko/$branch $branch <B>(12)</B>
|
|
done
|
|
$ git push --follow-tags ko <B>(13)</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>see what you were in the middle of doing, if anything.
|
|
<BR>
|
|
|
|
<B>2. </B>see which branches haven't been merged into
|
|
<B>master</B>
|
|
yet. Likewise for any other integration branches e.g.
|
|
<B>maint</B>,
|
|
<B>next</B>
|
|
and
|
|
<B>pu</B>
|
|
(potential updates).
|
|
<BR>
|
|
|
|
<B>3. </B>read mails, save ones that are applicable, and save others that are not quite ready (other mail readers are available).
|
|
<BR>
|
|
|
|
<B>4. </B>apply them, interactively, with your sign-offs.
|
|
<BR>
|
|
|
|
<B>5. </B>create topic branch as needed and apply, again with sign-offs.
|
|
<BR>
|
|
|
|
<B>6. </B>rebase internal topic branch that has not been merged to the master or exposed as a part of a stable branch.
|
|
<BR>
|
|
|
|
<B>7. </B>restart
|
|
<B>pu</B>
|
|
every time from the next.
|
|
<BR>
|
|
|
|
<B>8. </B>and bundle topic branches still cooking.
|
|
<BR>
|
|
|
|
<B>9. </B>backport a critical fix.
|
|
<BR>
|
|
|
|
<B>10. </B>create a signed tag.
|
|
<BR>
|
|
|
|
<B>11. </B>make sure master was not accidentally rewound beyond that already pushed out.
|
|
<BR>
|
|
|
|
<B>12. </B>In the output from
|
|
<B>git show-branch</B>,
|
|
<B>master</B>
|
|
should have everything
|
|
<B>ko/master</B>
|
|
has, and
|
|
<B>next</B>
|
|
should have everything
|
|
<B>ko/next</B>
|
|
has, etc.
|
|
<BR>
|
|
|
|
<B>13. </B>push out the bleeding edge, together with new tags that point into the pushed history.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
In this example, the <B>ko</B> shorthand points at the Git maintainer's repository at kernel.org, and looks like this:
|
|
<P>
|
|
<DL COMPACT><DT id="38"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
(in .git/config)
|
|
[remote "ko"]
|
|
url = kernel.org:/pub/scm/git/git.git
|
|
fetch = refs/heads/*:refs/remotes/ko/*
|
|
push = refs/heads/master
|
|
push = refs/heads/next
|
|
push = +refs/heads/pu
|
|
push = refs/heads/maint
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>REPOSITORY ADMINISTRATION</H2>
|
|
|
|
<P>
|
|
A repository administrator uses the following tools to set up and maintain access to the repository by developers.
|
|
<P>
|
|
<DL COMPACT><DT id="39"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-daemon">git-daemon</A></B>(1)
|
|
to allow anonymous download from repository.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="40"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-shell">git-shell</A></B>(1)
|
|
can be used as a
|
|
<I>restricted login shell</I>
|
|
for shared central repository users.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="41"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-http-backend">git-http-backend</A></B>(1)
|
|
provides a server side implementation of Git-over-HTTP ("Smart http") allowing both fetch and push services.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="42"><DD>
|
|
•
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+gitweb">gitweb</A></B>(1)
|
|
provides a web front-end to Git repositories, which can be set-up using the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+git-instaweb">git-instaweb</A></B>(1)
|
|
script.
|
|
</DL>
|
|
|
|
<P>
|
|
m[blue]<B>update hook howto</B>m[]<FONT SIZE="-2">[1]</FONT> has a good example of managing a shared central repository.
|
|
<P>
|
|
In addition there are a number of other widely deployed hosting, browsing and reviewing solutions such as:
|
|
<P>
|
|
<DL COMPACT><DT id="43"><DD>
|
|
•
|
|
|
|
|
|
gitolite, gerrit code review, cgit and others.
|
|
</DL>
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H3>Examples</H3>
|
|
|
|
<P>
|
|
|
|
We assume the following in /etc/services
|
|
<DL COMPACT><DT id="44"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="45"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ grep 9418 /etc/services
|
|
git 9418/tcp # Git Version Control System
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Run git-daemon to serve /pub/scm from inetd.
|
|
<DL COMPACT><DT id="46"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="47"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ grep git /etc/inetd.conf
|
|
git stream tcp nowait nobody \
|
|
/usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
The actual configuration line should be on one line.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Run git-daemon to serve /pub/scm from xinetd.
|
|
<DL COMPACT><DT id="48"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="49"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ cat /etc/xinetd.d/git-daemon
|
|
# default: off
|
|
# description: The Git server offers access to Git repositories
|
|
service git
|
|
{
|
|
disable = no
|
|
type = UNLISTED
|
|
port = 9418
|
|
socket_type = stream
|
|
wait = no
|
|
user = nobody
|
|
server = /usr/bin/git-daemon
|
|
server_args = --inetd --export-all --base-path=/pub/scm
|
|
log_on_failure += USERID
|
|
}
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
Check your <A HREF="/cgi-bin/man/man2html?8+xinetd">xinetd</A>(8) documentation and setup, this is from a Fedora system. Others might be different.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Give push/pull only access to developers using git-over-ssh.
|
|
<DL COMPACT><DT id="50"><DD>
|
|
e.g. those using:
|
|
<B>$ git push/pull <A HREF="ssh://host.xz/pub/scm/project">ssh://host.xz/pub/scm/project</A></B>
|
|
<P>
|
|
<DL COMPACT><DT id="51"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ grep git /etc/passwd <B>(1)</B>
|
|
alice:x:1000:1000::/home/alice:/usr/bin/git-shell
|
|
bob:x:1001:1001::/home/bob:/usr/bin/git-shell
|
|
cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell
|
|
david:x:1003:1003::/home/david:/usr/bin/git-shell
|
|
$ grep git /etc/shells <B>(2)</B>
|
|
/usr/bin/git-shell
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>log-in shell is set to /usr/bin/git-shell, which does not allow anything but
|
|
<B>git push</B>
|
|
and
|
|
<B>git pull</B>. The users require ssh access to the machine.
|
|
<BR>
|
|
|
|
<B>2. </B>in many distributions /etc/shells needs to list what is used as the login shell.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
CVS-style shared repository.
|
|
<DL COMPACT><DT id="52"><DD>
|
|
<P>
|
|
<DL COMPACT><DT id="53"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ grep git /etc/group <B>(1)</B>
|
|
git:x:9418:alice,bob,cindy,david
|
|
$ cd /home/devo.git
|
|
$ ls -l <B>(2)</B>
|
|
lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -> refs/heads/master
|
|
drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches
|
|
-rw-rw-r-- 1 david git 84 Dec 4 22:40 config
|
|
-rw-rw-r-- 1 david git 58 Dec 4 22:40 description
|
|
drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks
|
|
-rw-rw-r-- 1 david git 37504 Dec 4 22:40 index
|
|
drwxrwsr-x 2 david git 4096 Dec 4 22:40 info
|
|
drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects
|
|
drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs
|
|
drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes
|
|
$ ls -l hooks/update <B>(3)</B>
|
|
-r-xr-xr-x 1 david git 3536 Dec 4 22:40 update
|
|
$ cat info/allowed-users <B>(4)</B>
|
|
refs/heads/master alice\|cindy
|
|
refs/heads/doc-update bob
|
|
refs/tags/v[0-9]* david
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
<B>1. </B>place the developers into the same git group.
|
|
<BR>
|
|
|
|
<B>2. </B>and make the shared repository writable by the group.
|
|
<BR>
|
|
|
|
<B>3. </B>use update-hook example by Carl from Documentation/howto/ for branch policy control.
|
|
<BR>
|
|
|
|
<B>4. </B>alice and cindy can push into master, only bob can push into doc-update. david is the release manager and is the only person who can create and push version tags.
|
|
<BR>
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>GIT</H2>
|
|
|
|
<P>
|
|
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
|
|
<A NAME="lbAN"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="54"> 1.<DD>
|
|
update hook howto
|
|
<DL COMPACT><DT id="55"><DD>
|
|
<A HREF="file:///usr/share/doc/git/html/howto/update-hook-example.html">file:///usr/share/doc/git/html/howto/update-hook-example.html</A>
|
|
</DL>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="56"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="57"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="58"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="59"><A HREF="#lbAE">INDIVIDUAL DEVELOPER (STANDALONE)</A><DD>
|
|
<DL>
|
|
<DT id="60"><A HREF="#lbAF">Examples</A><DD>
|
|
</DL>
|
|
<DT id="61"><A HREF="#lbAG">INDIVIDUAL DEVELOPER (PARTICIPANT)</A><DD>
|
|
<DL>
|
|
<DT id="62"><A HREF="#lbAH">Examples</A><DD>
|
|
</DL>
|
|
<DT id="63"><A HREF="#lbAI">INTEGRATOR</A><DD>
|
|
<DL>
|
|
<DT id="64"><A HREF="#lbAJ">Examples</A><DD>
|
|
</DL>
|
|
<DT id="65"><A HREF="#lbAK">REPOSITORY ADMINISTRATION</A><DD>
|
|
<DL>
|
|
<DT id="66"><A HREF="#lbAL">Examples</A><DD>
|
|
</DL>
|
|
<DT id="67"><A HREF="#lbAM">GIT</A><DD>
|
|
<DT id="68"><A HREF="#lbAN">NOTES</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:08 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|