Re: master^ is not a local branch -- huh?!?

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: master^ is not a local branch -- huh?!?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:08

Ron Garret [off-list ref] writes:
My actual use case is very complicated, but here's a simplified version:

Suppose I'm using git as a back-end for a wiki.  I want to look at the 
state of the entire wiki as it was in some point in the past, and I also 
want to be able to look at the diffs between individual pages as they 
were then and as they are now.
Don't think you are so special ;-) "git checkout $that_old_commit" was
invented _exactly_ for that use case.  You can look around from that
state, and when you are done sightseeing, you can come back by doing a
"git checkout master" (or whichever branch you want to be on).

You don't necessarily have to check out an old state if the only thing
you are interested in is to review how the contents changed over time.
Use "git log -p" (from the current tip) for that.

If you chose to have an old checkout and then traverse the changes over
time leading to the current tip, you would say "git log -p ..master"
instead.

Re: master^ is not a local branch -- huh?!?

From: Ron Garret <hidden>
Date: 2016-06-15 22:48:08

In article [off-list ref],
 Junio C Hamano [off-list ref] wrote:
Ron Garret [off-list ref] writes:
quoted
My actual use case is very complicated, but here's a simplified version:

Suppose I'm using git as a back-end for a wiki.  I want to look at the 
state of the entire wiki as it was in some point in the past, and I also 
want to be able to look at the diffs between individual pages as they 
were then and as they are now.
Don't think you are so special ;-)
Never.  :-)
"git checkout $that_old_commit" was
invented _exactly_ for that use case.  You can look around from that
state, and when you are done sightseeing, you can come back by doing a
"git checkout master" (or whichever branch you want to be on).
Yes, that's what I would have expected.  Except that it not only updates 
my working tree, it updates my head also, so git diff doesn't give me 
the diffs that I want.  (This makes sense for the usual use case.)
You don't necessarily have to check out an old state if the only thing
you are interested in is to review how the contents changed over time.
Use "git log -p" (from the current tip) for that.

If you chose to have an old checkout and then traverse the changes over
time leading to the current tip, you would say "git log -p ..master"
instead.
There's also this:


git rev-list HEAD -- [filename]

git ls-tree [some-hash-from-the-list-above]

Then for each line in the result:

git cat-file blob [hash] > [filename]


which seems like a horrible hack, but actually does what I want.

rg
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help