All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: git@vger.kernel.org
Subject: How do I get the file contents from an arbitrary revision to stdout?
Date: Fri, 8 Oct 2021 17:51:17 +0000	[thread overview]
Message-ID: <YWCFFcNeNVTYcELN@ACM> (raw)

Hello, git.

I want to get a file's content from a particular revision onto stdout for
backup purposes.  I can't see how to do this.  Help me, please!

Let's say the file is foo.c, and I want to get the version from the head
revision of bar-branch.

I would like there to be a command something like:

    $ git cat bar-branch -- foo.c

..  Is there such a command, and if so, what's it called and how do I use
it?  I assumed it might be git cat-file, but I couldn't get it to work,
and couldn't understand it's man page.

Where might I have found this information for myself?

Thanks in advance for the help!

-- 
Alan Mackenzie (Nuremberg, Germany).

             reply	other threads:[~2021-10-08 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 17:51 Alan Mackenzie [this message]
2021-10-08 18:01 ` How do I get the file contents from an arbitrary revision to stdout? Konstantin Ryabitsev
2021-10-08 18:15   ` Alan Mackenzie
2021-10-08 20:02 ` Jeff King
2021-10-08 21:54   ` Junio C Hamano
2021-10-08 23:01     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWCFFcNeNVTYcELN@ACM \
    --to=acm@muc.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.