@ -50,6 +50,35 @@ Everybody uses these commands to feed and care git repositories.
@@ -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.
@ -88,7 +117,8 @@ following commands.
@@ -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>
@@ -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.
@@ -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 pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
@ -180,7 +212,8 @@ area we are interested in.
@@ -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.
@@ -219,7 +252,8 @@ commands in addition to the ones needed by participants.
@ -50,10 +50,14 @@ the `Makefile` to two revisions back, deletes hello.c by
@@ -50,10 +50,14 @@ the `Makefile` to two revisions back, deletes hello.c by
mistake, and gets it back from the index.
------------
$ git checkout master
$ git checkout master~2 Makefile
$ git checkout master <1>
$ git checkout master~2 Makefile <2>
$ rm -f hello.c
$ git checkout hello.c
$ git checkout hello.c <3>
<1> switch branch
<2> take out a file out of other commit
<3> or "git checkout -- hello.c", as in the next example.
------------
If you have an unfortunate branch that is named `hello.c`, the