git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Dennis Putnam <dap1@bellsouth.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Recovering Folder from Git Restored Repo
Date: Mon, 1 Aug 2016 17:18:25 -0400	[thread overview]
Message-ID: <20160801211824.cmjhpvdlohla7cbk@sigill.intra.peff.net> (raw)
In-Reply-To: <84080bca-af5f-b957-460a-0a4a81f383e7@bellsouth.net>

On Mon, Aug 01, 2016 at 04:58:47PM -0400, Dennis Putnam wrote:

> I am in a bit of a pickle. I deleted a remote repo that had a folder
> that I belatedly realized I need. The deleted repo exists on a backup
> which I restored. How do I extract the needed folder from that restored
> repo. Not being a git expert I'm not sure what to do but I cannot find
> any recognizable sources. This is an 'ls' of the restored repo:
> 
> branches  config  description  HEAD  hooks  info  objects  ref

That's a "bare" repository, which has no matching working tree, just the
git data. The simplest thing may be to just clone it; the clone will
have a working tree:

  git clone /path/to/restored-repo tmp
  cd tmp

and then you can pick out whatever files you like.

You can also extract the data straight from the bare repository.  Try
"git ls-tree -r HEAD" to see the complete listing of files (replace HEAD
with the name of a specific branch if it was there). You can extract
individual files with "git show HEAD:path/to/file". Or you can generate
a tar or zip archive of a subtree like:

  git archive --format=zip HEAD:my-subdir >foo.zip

-Peff

      reply	other threads:[~2016-08-01 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 20:58 Recovering Folder from Git Restored Repo Dennis Putnam
2016-08-01 21:18 ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20160801211824.cmjhpvdlohla7cbk@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=dap1@bellsouth.net \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).