Re: Contents of file for a commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill Lear <rael@xxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux