git/list[1] front-page[2] threads[3] people[4] search[5] about
 

'git show' with multiple revisions

From
EAEd Avis <eda@waniasset.com>
Date
Apr 28, 2015, 10:10 UTC
Message-ID
<loom.20150428T120412-982@post.gmane.org>

I would like to see the content of a file in multiple revisions. I can get them with 'git show' as follows:

    % git show REV1:FILE
    % git show REV2:FILE

and so on. But that launches a new process for each revision. Now, there is the option to pass multiple arguments to 'git show':

    % git show REV1:FILE REV2:FILE

This gets both revisions in a single process and so is faster. But it concatenates the content so there isn't a way to separate them out again.

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
The question is what format should be used to output many strings to stdout.
An alternative would be to specify an output file:
    % git show --output foo REV1:FILE                        # writes foo
    % git show --output foo REV1:FILE --output bar REV2:FILE # writes foo, bar

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?

Thanks,
-- 
Ed Avis <eda@waniasset.com>
Next: Jeff King
Message 1 of 7 in “'git show' with multiple revisions”
  1. Ed AvisApr 28, 2015
  2. Jeff KingApr 29, 2015
  3. Ed AvisApr 29, 2015
  4. Jeff KingApr 29, 2015
  5. Junio C HamanoApr 29, 2015
  6. Ed AvisApr 29, 2015
  7. Junio C HamanoApr 29, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.