Gmane
From: Johannes Schindelin <Johannes.Schindelin <at> gmx.de>
Subject: Re: Git checkout preserve timestamp?
Newsgroups: gmane.comp.version-control.git
Date: 2007-03-01 22:13:27 GMT (2 years, 17 weeks, 6 days, 1 hour and 35 minutes ago)
Hi Bill,

On Thu, 1 Mar 2007, Bill Lear wrote:

> I often find myself in branch A, with everything checked in and 
> compiled, wanting to look at something on branch B.

I did that, too, until git-show learnt about the nice ":" syntax.

For example, if I want to know what is in branch B, I do

	$ git show B:

which shows the root directory of the revision "B" (this is in line with 
<commit>:<pathspec> if you interpret "" as the root path). The subtrees 
are all identified by trailing slashes. Then you can say

	$ git show B:Documentation/Makefile

If you want to know the differences to the file "doc/GNUMakefile" in your 
current working tree, do

	$ git diff B:Documentation/Makefile -- doc/GNUMakefile

No need to switch branches.

And if you _do_ need to switch branches, why not make a local clone, 
sharing the object database:

	$ git clone -l -s . test-directory

This is _very_ fast, since it basically checks out the branches in 
test-directory/. Right now, you have to go to the test-directory, and 
switch the branches manually (I think), but talk has been that you may be 
able to tell git-clone which branch you really want.

Hth,
Dscho