From daba3bb77d0b9bbd08d812c539f5bb6580da14c0 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 28 Sep 2007 09:29:34 -0700 Subject: [PATCH] Motivate the desired to checkout old revisions without reference to 'hg update' --- tour.mdwn | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tour.mdwn b/tour.mdwn index 19b0061..0ddf408 100644 --- 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).] -#### 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 @@ -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. +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: -- 2.45.2