From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carl Worth Subject: Re: several quick questions Date: Tue, 14 Feb 2006 10:10:53 -0800 Message-ID: <87k6bxvmj6.wl%cworth@cworth.org> References: <43F20532.5000609@iaglans.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Tue_Feb_14_10:10:46_2006-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Cc: "Nicolas Vilz 'niv'" , git X-From: git-owner@vger.kernel.org Tue Feb 14 19:12:23 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F94ec-0007xu-D0 for gcvg-git@gmane.org; Tue, 14 Feb 2006 19:11:58 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422754AbWBNSLz (ORCPT ); Tue, 14 Feb 2006 13:11:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1422757AbWBNSLz (ORCPT ); Tue, 14 Feb 2006 13:11:55 -0500 Received: from theworths.org ([217.160.253.102]:52938 "EHLO theworths.org") by vger.kernel.org with ESMTP id S1422750AbWBNSLx (ORCPT ); Tue, 14 Feb 2006 13:11:53 -0500 Received: (qmail 30969 invoked from network); 14 Feb 2006 13:11:48 -0500 Received: from localhost (HELO raht.localdomain) (127.0.0.1) by localhost with SMTP; 14 Feb 2006 13:11:48 -0500 To: Linus Torvalds In-Reply-To: User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: --pgp-sign-Multipart_Tue_Feb_14_10:10:46_2006-1 Content-Type: text/plain; charset=US-ASCII On Tue, 14 Feb 2006 09:05:16 -0800 (PST), Linus Torvalds wrote: > > Both of these can be solved with "git reset". ... > - "git branch". This creates a new branch of development at an arbitrary > point (that defaults to "current state"). > > - "git checkout". This switches to another branch. > > - "git reset". This will reset the current branch state to something > else. Thanks for the summary. I don't know if it's the original poster's question or not, but an operation I don't see in the above is "put the working files into the state of a given revision". I recently needed this for some historical investigation, (specifically examining all release tags to ensure that the results after a git import match the results of what we get from the former CVS repository). In this kind of historical exploration, the notion of a "current branch" isn't interesting, since I won't be doing any commits. So the handling of the current branch in the above commands ends up getting in my way [*]. Is there a more fundamental operation to "put the working files into the state of the index"? If that exists, then that combined with git-read-tree would give me what I wanted I think. -Carl [*] I did succeed in performing the operation, but only in rather awkward ways. Here are a couple of versions of "put the working files into the state of ", both requiring the use of an otherwise unnecessary branch, (bogus-branch): 1) Ensure bogus-branch doesn't exist, then create it at : # Can't be on bogus-branch when we delete it git checkout master # Use -D to force the removal, ignore errors for branch-does-not-exist git branch -D bogus-branch >& /dev/null || true # Create the branch where we want it git checkout -b bogus-branch 2) Ensure that bogus-branch exists somewhere (don't care where), then move it: # Create the branch (if it doesn't exist) git checkout -b bogus-branch >& /dev/null # Switch to it (which doesn't happen above if it already existed) git checkout bogus-branch # Move the branch to the revision of interest git reset --hard --pgp-sign-Multipart_Tue_Feb_14_10:10:46_2006-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD8h0t6JDdNq8qSWgRAs1tAKCiL9YXH11boMqpZzu9iG1j9/GoRwCdHmpw owSI717aRRN8KfL3u58Hs6I= =tVT0 -----END PGP SIGNATURE----- --pgp-sign-Multipart_Tue_Feb_14_10:10:46_2006-1--