Re: 'git show' with multiple revisions

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

 



On Tue, Apr 28, 2015 at 10:10:52AM +0000, Ed Avis wrote:

> Could 'git show' sprout an option to get multiple things programmatically
> so that they can be separated out again?  One way would be to quote or escape
> the contents somehow so that the result can be parsed:
> 
>     % git show --porcelain REV1:FILE REV2:FILE
>
> [...]
>
> Note that here I am only getting the file content, not log messages or any of
> the other things which 'git show' can produce.  So perhaps what I really want
> is some kind of 'git cat'.  Or is there another more appropriate tool?

I think you want `git cat-file`:

  {
	echo REV1:FILE
	echo REV2:FILE
  } |
  git cat-file --batch

This prints a header line for each output object which contains the size
of the object (so a parser reads a header line, then N bytes, then a
header line, N bytes, and so on).

-Peff
--
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]