git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to archive repo from sub-directory
@ 2008-03-11  0:33 Bill Lear
  2008-03-11  3:22 ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Lear @ 2008-03-11  0:33 UTC (permalink / raw)
  To: git

If I have a git repo with several levels of sub-directories, how
do I get git-archive to archive the entire tree, and not just
the tree from where I am?  Example:

% cd foo
% cat .git/description
foo project
% cd bar/baz
% git archive --format=tar --prefix=foo/ HEAD | bzip2 > foo.tar.bz2

produces a tar file starting only at baz.

If I can't conjur this on the command line with a clever argument to
git archive (I've tried several), then how would I ask git "What is
your top-level directory" so at least I could write a script to
do this?


Bill

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to archive repo from sub-directory
  2008-03-11  0:33 How to archive repo from sub-directory Bill Lear
@ 2008-03-11  3:22 ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 2+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2008-03-11  3:22 UTC (permalink / raw)
  To: Bill Lear; +Cc: git

On Tue, Mar 11, 2008 at 7:33 AM, Bill Lear <rael@zopyra.com> wrote:
> If I have a git repo with several levels of sub-directories, how
>  do I get git-archive to archive the entire tree, and not just
>  the tree from where I am?  Example:
>
>  % cd foo
>  % cat .git/description
>  foo project
>  % cd bar/baz
>  % git archive --format=tar --prefix=foo/ HEAD | bzip2 > foo.tar.bz2
>
>  produces a tar file starting only at baz.
>
>  If I can't conjur this on the command line with a clever argument to
>  git archive (I've tried several), then how would I ask git "What is
>  your top-level directory" so at least I could write a script to
>  do this?

You can move back to top-level dir with "cd $(git rev-parse
--show-cdup)". Another way is take "git rev-parse --show-prefix"
result (which would be "bar/baz/") and process it yourself.
-- 
Duy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-11  3:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11  0:33 How to archive repo from sub-directory Bill Lear
2008-03-11  3:22 ` Nguyen Thai Ngoc Duy

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 NNTP newsgroup(s).