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

Re: [Feature Request] git export

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Aug 11, 2009, 07:50 UTC
Message-ID
<4A8122BC.7030009@drmicha.warpmail.net>
In-Reply-To
<200908101822.59940.thomas@koch.ro>
Thomas Koch venit, vidit, dixit 10.08.2009 18:22:
Show 9 quoted lines
> could you please provide a simple solution to save a tree object into an 
> arbitrary location?
> I found some hints, that it would be possible by missusing either git 
> checkout-index or git-archive, but I think that it shouldn't require that much 
> GIT FU to do such a simple thing.
> 
> Thanks,
> 
> Thomas Koch, http://www.koch.ro
To serve you with an explicit command line, it's really only
git archive HEAD | tar -C wheretoexport/ -xf-

which you need to issue from within your git repo. Instead of HEAD, you can use any "treeish", for example the name of a branch, which need not be checked out. You can add path arguments after the treeish if you want to export only parts of your repo.

Note that in true unix philosophy, git archive does the (git specific) exporting only and leaves the importing into the file system (saving) to the proper tool. I mean, would you rather use cp -r or pipes with tar -x/tar -c or cpio -i/-o in order to copy a tree? ;)

Cheers, Michael

Previous: Johannes Schindelin
Message 7 of 7 in “[Feature Request] git export”
  1. Thomas KochAug 10, 2009
  2. Tim VisherAug 10, 2009
  3. Thomas KochAug 10, 2009
  4. Tim VisherAug 10, 2009
  5. Junio C HamanoAug 10, 2009
  6. Johannes SchindelinAug 10, 2009
  7. Michael J GruberAug 11, 2009

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.