]> git.cworth.org Git - hgbook-git/commitdiff
Motivate the desired to checkout old revisions without reference to 'hg update'
authorCarl Worth <cworth@cworth.org>
Fri, 28 Sep 2007 16:29:34 +0000 (09:29 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 28 Sep 2007 16:29:34 +0000 (09:29 -0700)
tour.mdwn

index 19b00613c3850b505220dd68845eba46fe0bef46..0ddf4081d52498a34f25f34680a0f06ff8eb32a8 100644 (file)
--- a/tour.mdwn
+++ b/tour.mdwn
@@ -1037,21 +1037,21 @@ seems a little intimidating, understand that it's because things are
 not presented in the most natural "git way", (and I'm a little too
 tired to fix it tonight).]
 
 not presented in the most natural "git way", (and I'm a little too
 tired to fix it tonight).]
 
-#### 2.8.2  Checking out previous revisions
+Note: Mercurial users who are reading this might wonder if there's a
+need for the equivalent of "hg update" after doing a "git pull". And
+the answer is no. Unlike mercurial, "git pull" and "git merge" will
+automatically update the workind-directory files as necessary.
 
 
-If any users of mercurial are reading this, they might wonder if
-there's a need for the equivalent of "hg update" after doing a "git
-pull". And the answer is no. Unlike mercurial, "git pull" and "git
-merge" will automatically update the workind-directory files as
-necessary.
+#### 2.8.2  Checking out previous revisions
 
 
-But there's another function provided by "hg update" which is to
-update the working-directory files to a particular revision. In git,
-this functionality is provided by the "git checkout" command. To
-checkout a particular branch, tag, or an arbitrary revions, simply
-give the appropriate name to the "git checkout" command. For example,
-to examine the files as they existed before the original typo
-introduction, we could do:
+It's often useful to examine the working-tree state of some specific
+revision other than the tip of some branch. For example, maybe you
+would like to build a particular tagged version, or maybe you'd like
+to test the behavior of the code before a particular change was
+introduced. To do this, use "git checkout" and pass it the name of any
+revision, (with a branch name, a tag name, or any other commit
+identifier). For example, to examine our project before the original
+typo was introduced:
 
        $ git checkout 0a633bf5
        Note: moving to "0a633bf5" which isn't a local branch
 
        $ git checkout 0a633bf5
        Note: moving to "0a633bf5" which isn't a local branch
@@ -1066,6 +1066,10 @@ history, but if we actually wanted to use this revision as the basis
 for new commits, we would first have to create a new branch name as it
 describes.
 
 for new commits, we would first have to create a new branch name as it
 describes.
 
+If we were to use "git checkout" with a branch name, then that would
+change the current branch, (meaning that any new commits would advance
+that branch pointer).
+
 For now, let's return back to the tip of the master branch by just
 checking it out again:
 
 For now, let's return back to the tip of the master branch by just
 checking it out again: