* Contents of file for a commit
@ 2008-01-27 4:22 Bill Lear
2008-01-27 4:28 ` Jeff King
2008-01-27 4:40 ` Shawn O. Pearce
0 siblings, 2 replies; 6+ messages in thread
From: Bill Lear @ 2008-01-27 4:22 UTC (permalink / raw)
To: git
How can I do the equivalent of 'cvs co -r <commit> -p <file>' in git?
I want to see the entire contents of a file as it existed after a
particular commit was introduced.
Bill
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Contents of file for a commit
2008-01-27 4:22 Contents of file for a commit Bill Lear
@ 2008-01-27 4:28 ` Jeff King
2008-01-27 4:40 ` Shawn O. Pearce
1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2008-01-27 4:28 UTC (permalink / raw)
To: Bill Lear; +Cc: git
On Sat, Jan 26, 2008 at 10:22:58PM -0600, Bill Lear wrote:
> How can I do the equivalent of 'cvs co -r <commit> -p <file>' in git?
> I want to see the entire contents of a file as it existed after a
> particular commit was introduced.
Try 'git show <commit>:<file>'.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Contents of file for a commit
2008-01-27 4:22 Contents of file for a commit Bill Lear
2008-01-27 4:28 ` Jeff King
@ 2008-01-27 4:40 ` Shawn O. Pearce
2008-01-27 4:49 ` Jeff King
1 sibling, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-01-27 4:40 UTC (permalink / raw)
To: Bill Lear; +Cc: git
Bill Lear <rael@zopyra.com> wrote:
> How can I do the equivalent of 'cvs co -r <commit> -p <file>' in git?
> I want to see the entire contents of a file as it existed after a
> particular commit was introduced.
`git checkout $commit -- $path`
would get the file at that version into your working directory,
but also will update the index, thus staging the file for the
next commit.
You can also just view the file if you don't want those changes
to be made:
`git show $commit -- $path`
If you are scripting, use cat-file directly to avoid any CRLF
conversion or whatnot:
`git cat-file blob $commit:$path`
--
Shawn.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Contents of file for a commit
2008-01-27 4:40 ` Shawn O. Pearce
@ 2008-01-27 4:49 ` Jeff King
2008-01-27 5:01 ` Shawn O. Pearce
0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2008-01-27 4:49 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Bill Lear, git
On Sat, Jan 26, 2008 at 11:40:27PM -0500, Shawn O. Pearce wrote:
> You can also just view the file if you don't want those changes
> to be made:
>
> `git show $commit -- $path`
That doesn't work. It says "show me $commit, but limited by $path". So
if $path was changed, you see the commit log and diff. If it wasn't, you
see nothing.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Contents of file for a commit
2008-01-27 4:49 ` Jeff King
@ 2008-01-27 5:01 ` Shawn O. Pearce
2008-01-27 14:31 ` Bill Lear
0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-01-27 5:01 UTC (permalink / raw)
To: Jeff King; +Cc: Bill Lear, git
Jeff King <peff@peff.net> wrote:
> On Sat, Jan 26, 2008 at 11:40:27PM -0500, Shawn O. Pearce wrote:
>
> > You can also just view the file if you don't want those changes
> > to be made:
> >
> > `git show $commit -- $path`
>
> That doesn't work. It says "show me $commit, but limited by $path". So
> if $path was changed, you see the commit log and diff. If it wasn't, you
> see nothing.
Gah. Indeed. I should have suggested to Bill:
`git show $commit:$path`
sorry about the confusion, and thanks for the clarification. :-)
--
Shawn.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Contents of file for a commit
2008-01-27 5:01 ` Shawn O. Pearce
@ 2008-01-27 14:31 ` Bill Lear
0 siblings, 0 replies; 6+ messages in thread
From: Bill Lear @ 2008-01-27 14:31 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Jeff King, git
On Sunday, January 27, 2008 at 00:01:28 (-0500) Shawn O. Pearce writes:
>Jeff King <peff@peff.net> wrote:
>> On Sat, Jan 26, 2008 at 11:40:27PM -0500, Shawn O. Pearce wrote:
>>
>> > You can also just view the file if you don't want those changes
>> > to be made:
>> >
>> > `git show $commit -- $path`
>>
>> That doesn't work. It says "show me $commit, but limited by $path". So
>> if $path was changed, you see the commit log and diff. If it wasn't, you
>> see nothing.
>
>Gah. Indeed. I should have suggested to Bill:
>
>`git show $commit:$path`
>
>sorry about the confusion, and thanks for the clarification. :-)
Ok, looks like that works. Thanks all.
Bill
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-01-27 14:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-27 4:22 Contents of file for a commit Bill Lear
2008-01-27 4:28 ` Jeff King
2008-01-27 4:40 ` Shawn O. Pearce
2008-01-27 4:49 ` Jeff King
2008-01-27 5:01 ` Shawn O. Pearce
2008-01-27 14:31 ` Bill Lear
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox