{"thread":{"id":"12625","subject":"How to archive repo from sub-directory","startedAt":"2008-03-11T00:33:04Z","lastAt":"2008-03-11T03:22:54Z","messageCount":2,"participants":["Bill Lear","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"71633","messageId":"18389.54080.211086.922039@lisa.zopyra.com","threadId":"12625","inReplyTo":null,"subject":"How to archive repo from sub-directory","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2008-03-11T00:33:04Z","receivedAt":"2008-03-11T00:33:04Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"If I have a git repo with several levels of sub-directories, how\ndo I get git-archive to archive the entire tree, and not just\nthe tree from where I am?  Example:\n\n% cd foo\n% cat .git/description\nfoo project\n% cd bar/baz\n% git archive --format=tar --prefix=foo/ HEAD | bzip2 > foo.tar.bz2\n\nproduces a tar file starting only at baz.\n\nIf I can't conjur this on the command line with a clever argument to\ngit archive (I've tried several), then how would I ask git \"What is\nyour top-level directory\" so at least I could write a script to\ndo this?\n\n\nBill\n"},{"id":"71647","messageId":"fcaeb9bf0803102022s3cefd1d0jcea74fcf5ac69f6c@mail.gmail.com","threadId":"12625","inReplyTo":"18389.54080.211086.922039@lisa.zopyra.com","subject":"Re: How to archive repo from sub-directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2008-03-11T03:22:54Z","receivedAt":"2008-03-11T03:22:54Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Mar 11, 2008 at 7:33 AM, Bill Lear <rael@zopyra.com> wrote:\n> If I have a git repo with several levels of sub-directories, how\n>  do I get git-archive to archive the entire tree, and not just\n>  the tree from where I am?  Example:\n>\n>  % cd foo\n>  % cat .git/description\n>  foo project\n>  % cd bar/baz\n>  % git archive --format=tar --prefix=foo/ HEAD | bzip2 > foo.tar.bz2\n>\n>  produces a tar file starting only at baz.\n>\n>  If I can't conjur this on the command line with a clever argument to\n>  git archive (I've tried several), then how would I ask git \"What is\n>  your top-level directory\" so at least I could write a script to\n>  do this?\n\nYou can move back to top-level dir with \"cd $(git rev-parse\n--show-cdup)\". Another way is take \"git rev-parse --show-prefix\"\nresult (which would be \"bar/baz/\") and process it yourself.\n-- \nDuy\n"}]}