]> git.cworth.org Git - hgbook-git/commitdiff
Port section 2.3 (working with a repository) from mercurial to git
authorCarl Worth <cworth@cworth.org>
Thu, 27 Sep 2007 23:43:38 +0000 (16:43 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 27 Sep 2007 23:43:38 +0000 (16:43 -0700)
tour.mdwn

index e6429f24592acec073ac8df11b235f311b307a83..8c2fda550e6c297320dd79851863e114d61f7976 100644 (file)
--- a/tour.mdwn
+++ b/tour.mdwn
@@ -127,12 +127,12 @@ present and just call out to "man git-<foo>"?]
 
 ### 2.3  Working with a repository
 
-In Mercurial, everything happens inside a repository. The repository
+In git, everything happens inside a repository. The repository
 for a project contains all of the files that “belong to” that project,
 along with a historical record of the project’s files.
 
 There’s nothing particularly magical about a repository; it is simply
-a directory tree in your filesystem that Mercurial treats as
+a directory tree in your filesystem that git treats as
 special. You can rename or delete a repository any time you like,
 using either the command line or your file browser.
 
@@ -140,32 +140,62 @@ using either the command line or your file browser.
 
 Copying a repository is just a little bit special. While you could use
 a normal file copying command to make a copy of a repository, it’s
-best to use a built-in command that Mercurial provides. This command
-is called “hg clone”, because it creates an identical copy of an
+best to use a built-in command that git provides. This command
+is called “git clone”, because it creates an identical copy of an
 existing repository.
 
-       $ hg clone http://hg.serpentine.com/tutorial/hello   
-       destination directory: hello   
-       requesting all changes   
-       adding changesets   
-       adding manifests   
-       adding file changes   
-       added 5 changesets with 5 changes to 2 files   
-       2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+       $ git clone git://cworth.org/git/hello
+       Initialized empty Git repository in /tmp/hello/.git/
+       remote: Generating pack...
+       remote: Done counting 15 objects.
+       remote: Deltifying 15 objects...
+       remote:  100% (15/15) done
+       remote: Total 15 (delta 2), reused 0 (delta 0)
+       Indexing 15 objects...
+        100% (15/15) done
+       Resolving 2 deltas...
+        100% (2/2) done
+
+If for some reason you are prevented from talking on the git: port,
+then there is also the capability to clone a repository (less
+efficiently) over http:
+
+       $ git clone http://cworth.org/git/hello
+       Initialized empty Git repository in /tmp/hello/.git/
+       got 8e5536eaf0c9313cfcfd3bb915c7ebb63d6f7a91
+       walk 8e5536eaf0c9313cfcfd3bb915c7ebb63d6f7a91
+       got e4c1447f272c0f90e0a80e55f495ec377863f6f5
+       got d884386a016f03bdd6c2c72ceba5621568cc0329
+       got 350a36688de4ee9dfeba52f09bf02385cb967bb2
+       walk d884386a016f03bdd6c2c72ceba5621568cc0329
+       got 9a3ff79a7c30a4b990d49fe7c9095d6bd2eab6c0
+       got ab82c5460482579faae7841e8da3b98fbb34a41c
+       got e19aeb100a31497481bba401cea42a39fac230ae
+       walk e19aeb100a31497481bba401cea42a39fac230ae
+       got 80b260cae9cec3cd52d27c46741ff59c321b852c
+       got 23f952d3dccd5524c3c1b48b3558a5b7393286c2
+       got 9fa6a8464b692252de9a3a20c9e579700d613b17
+       walk 9fa6a8464b692252de9a3a20c9e579700d613b17
+       got b8937ca165a312157658a67e7d413dd59e6ad377
+       got b3f85f210ff86d334575f64cb01c5bf49895b63e
+       got 556e69f96b04bff82857ddd7f7c08b2f3231d664
+       walk 556e69f96b04bff82857ddd7f7c08b2f3231d664
+       got ed55ec04ebc1736a91997a6ce7d7091010647c3d
+       got 43d727f2f3f2f7cb3b098ddad1d7038464a4cee2
 
 If our clone succeeded, we should now have a local directory called
 hello. This directory will contain some files.
 
-       $ ls -l   
-       total 4   
-       drwxrwxr-x 3 bos bos 4096 Jun 17 18:05 hello   
-       $ ls hello   
-       Makefile  hello.c
+       $ ls -l
+       total 4
+       drwxr-xr-x 3 cworth cworth 4096 2007-09-27 16:40 hello
+       $ ls hello
+       hello.c  Makefile
 
 These files have the same contents and history in our repository as
 they do in the repository we cloned.
 
-Every Mercurial repository is complete, self-contained, and
+Every git repository is complete, self-contained, and
 independent. It contains its own private copy of a project’s files and
 history. A cloned repository remembers the location of the repository
 it was cloned from, but it does not communicate with that repository,
@@ -178,18 +208,18 @@ won’t affect anyone else.
 #### 2.3.2  What’s in a repository?
 
 When we take a more detailed look inside a repository, we can see that
-it contains a directory named .hg. This is where Mercurial keeps all
+it contains a directory named .git. This is where git keeps all
 of its metadata for the repository.
 
-       $ cd hello   
-       $ ls -a   
-       .  ..  .hg  Makefile  hello.c
+       $ cd hello
+       $ ls -a
+       .  ..  .git  hello.c  Makefile
 
-The contents of the .hg directory and its subdirectories are private
-to Mercurial. Every other file and directory in the repository is
+The contents of the .git directory and its subdirectories are private
+to git. Every other file and directory in the repository is
 yours to do with as you please.
 
-To introduce a little terminology, the .hg directory is the “real”
+To introduce a little terminology, the .git directory is the “real”
 repository, and all of the files and directories that coexist with it
 are said to live in the working directory. An easy way to remember the
 distinction is that the repository contains the history of your
@@ -231,7 +261,7 @@ view of history.
        
 
 By default, this command prints a brief paragraph of output for each
-change to the project that was recorded. In Mercurial terminology, we
+change to the project that was recorded. In git terminology, we
 call each of these recorded events a changeset, because it can contain
 a record of changes to several files.