diff options
Diffstat (limited to 'Documentation/everyday.txt')
-rw-r--r-- | Documentation/everyday.txt | 99 |
1 files changed, 79 insertions, 20 deletions
diff --git a/Documentation/everyday.txt b/Documentation/everyday.txt index 88df3ffc28..88bd88963a 100644 --- a/Documentation/everyday.txt +++ b/Documentation/everyday.txt @@ -50,6 +50,35 @@ Everybody uses these commands to feed and care git repositories. * gitlink:git-repack[1] to pack loose objects for efficiency. +Examples +~~~~~~~~ + +Check health and remove cruft:: ++ +------------ +$ git fsck-objects <1> +$ git prune +$ git count-objects <2> +$ git repack <3> +$ git prune <4> + +<1> running without "--full" is usually cheap and assures the +repository health reasonably well. +<2> check how many loose objects there are and how much +diskspace is wasted by not repacking. +<3> without "-a" repacks incrementally. repacking every 4-5MB +of loose objects accumulation may be a good rule of thumb. +<4> after repack, prune removes the duplicate loose objects. +------------ + +Repack a small project into single pack:: ++ +------------ +$ git repack -a -d <1> +$ git prune +------------ + + Individual Developer (Standalone)[[Individual Developer (Standalone)]] ---------------------------------------------------------------------- @@ -88,7 +117,8 @@ following commands. Examples ~~~~~~~~ -* Extract a tarball and create a working tree and a new repository to keep track of it. +Extract a tarball and create a working tree and a new repository to keep track of it:: ++ ------------ $ tar zxf frotz.tar.gz $ cd frotz @@ -101,7 +131,8 @@ $ git tag v2.43 <2> <2> make a lightweight, unannotated tag. ------------ -* Create a topic branch and develop +Create a topic branch and develop:: ++ ------------ $ git checkout -b alsa-audio <1> $ edit/compile/test @@ -158,12 +189,13 @@ addition to the ones needed by a standalone developer. Examples ~~~~~~~~ -* Clone the upstream and work on it. Feed changes to upstream. +Clone the upstream and work on it. Feed changes to upstream:: ++ ------------ $ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6 $ cd my2.6 $ edit/compile/test; git commit -a -s <1> -$ git format-patch master <2> +$ git format-patch origin <2> $ git pull <3> $ git whatchanged -p ORIG_HEAD.. arch/i386 include/asm-i386 <4> $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5> @@ -180,7 +212,8 @@ area we are interested in. <7> garbage collect leftover objects from reverted pull. ------------ -* Branch off of a specific tag. +Branch off of a specific tag:: ++ ------------ $ git checkout -b private2.6.14 v2.6.14 <1> $ edit/compile/test; git commit -a @@ -219,7 +252,8 @@ commands in addition to the ones needed by participants. Examples ~~~~~~~~ -* My typical GIT day. +My typical GIT day:: ++ ------------ $ git status <1> $ git show-branch <2> @@ -231,16 +265,17 @@ $ git checkout master $ git am -3 -i -s -u ./+to-apply <4> $ compile/test $ git checkout -b hold/linus && git am -3 -i -s -u ./+hold-linus <5> -$ git checkout pu && git reset --hard master <6> -$ git pull . topic/one topic/two && git pull . hold/linus <7> +$ git checkout topic/one && git rebase master <6> +$ git checkout pu && git reset --hard master <7> +$ git pull . topic/one topic/two && git pull . hold/linus <8> $ git fetch ko master:refs/tags/ko-master && - git show-branch master ko-master <8> -$ git push ko <9> + git show-branch master ko-master <9> +$ git push ko <10> $ git checkout maint -$ git cherry-pick master~4 <10> +$ git cherry-pick master~4 <11> $ compile/test -$ git tag -s -m 'GIT 0.99.9x' v0.99.9x <11> -$ git push ko v0.99.9x <12> +$ git tag -s -m 'GIT 0.99.9x' v0.99.9x <12> +$ git push ko v0.99.9x <13> <1> see what I was in the middle of doing, if any. <2> see what topic branches I have and think about how ready @@ -250,14 +285,16 @@ that are not quite ready. <4> apply them, interactively, with my sign-offs. <5> create topic branch as needed and apply, again with my sign-offs. -<6> restart "pu" every time from the master. -<7> and bundle topic branches still cooking. -<8> make sure I did not accidentally rewound master beyond what I +<6> rebase internal topic branch that has not been merged to the +master, nor exposed as a part of a stable branch. +<7> restart "pu" every time from the master. +<8> and bundle topic branches still cooking. +<9> make sure I did not accidentally rewound master beyond what I already pushed out. -<9> push out the bleeding edge. -<10> backport a critical fix. -<11> create a signed tag. -<12> push the tag out. +<10> push out the bleeding edge. +<11> backport a critical fix. +<12> create a signed tag. +<13> push the tag out. ------------ @@ -276,3 +313,25 @@ and maintain access to the repository by developers. * link:howto/update-hook-example.txt[update hook howto] has a good example of managing a shared central repository. + +Examples +~~~~~~~~ + +Run git-daemon to serve /pub/scm from inetd:: ++ +------------ +$ grep git /etc/inet.conf +git stream tcp nowait nobody /usr/bin/git-daemon git-daemon --inetd --syslog --export-all /pub/scm +------------ + +Give push/pull only access to developers:: ++ +------------ +$ grep git /etc/shells +/usr/bin/git-shell +$ grep git /etc/passwd +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 +------------ |