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

Re: I don't want the .git directory next to my code.

From
MMike <fromlists@talkingspider.com>
Date
Jan 16, 2008, 17:23 UTC
Message-ID
<478E3D7D.4000700@talkingspider.com>
In-Reply-To
<D017F6F6-D674-428B-936B-181BF20CF4B5@vicaya.com>
Luke Lu wrote:
Show 46 quoted lines
> 
> On Jan 15, 2008, at 8:18 PM, Mike wrote:
> 
>>
>> David Symonds wrote:
>>> On Jan 16, 2008 2:27 PM, Mike <fromlists@talkingspider.com> wrote:
>>>> 2. If I tar/gz my code and deliver it to a client, I don't want the 
>>>> .git
>>>> dir slipping into the tarball, allowing my client to be able to peruse
>>>> the history of what we did and when.
>>> Use git-archive.
>>
>> Thanks but this isn't sufficient. If we have one directory of our web 
>> root in a git repository, say docroot/php, and we tar up docroot, it 
>> will include php/.git.  We don't want that.  We would have to go out 
>> of our way to avoid the .git directory.  The point is, we don't want 
>> anything in docroot that shouldn't be made live.
> 
> git-archive generates an archive file *without* the .git directory. From 
> git-archive(1):
> 
>   git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)
>               Create a tar archive that contains the contents of the latest
>               commit on the current branch, and extracts it in 
> /var/tmp/junk
>               directory.
> 
>   git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip > 
> git-1.4.0.tar.gz
>               Create a compressed tarball for v1.4.0 release.
> 
>   git archive --format=tar --prefix=git-1.4.0/ v1.4.0^{tree} | gzip 
>  >git-1.4.0.tar.gz
>               Create a compressed tarball for v1.4.0 release, but without a
>               global extended pax header.
> 
>   git archive --format=zip --prefix=git-docs/ HEAD:Documentation/ > 
> git-1.4.0-docs.zip
>               Put everything in the current head's Documentation/ directory
>               into git-1.4.0-docs.zip, with the prefix git-docs/.
> 
> IMHO, git export is probably a better name for the command. git-archive 
> sounds like backup everything associated with git.
> 
> __Luke
> -

OK I don't think you read my response closely. I wasn't going to respond except I see Johannes missed the point too.

I completely understand that git archive will not inlcude the .git dir. What you missed in my response is the case where someone tars up a directory above the .git directory. Not all of the content under doc root is in a git archive.

Previous: Luke LuNext: Sam Vilain
Message 45 of 65 in “I don't want the .git directory next to my code.”
  1. MikeJan 16, 2008
  2. Randal L. SchwartzJan 16, 2008
  3. MikeJan 16, 2008
  4. David SymondsJan 16, 2008
  5. MikeJan 16, 2008
  6. SeanJan 16, 2008
  7. MikeJan 16, 2008
  8. Neil MacnealeJan 16, 2008
  9. MikeJan 16, 2008
  10. Johannes SchindelinJan 16, 2008
  11. Linus TorvaldsJan 16, 2008
  12. Linus TorvaldsJan 16, 2008
  13. MikeJan 17, 2008
  14. Kris ShannonJan 17, 2008
  15. Wincent ColaiutaJan 17, 2008
  16. Jeff KingJan 17, 2008
  17. Linus TorvaldsJan 17, 2008
  18. Johannes SchindelinJan 17, 2008
  19. Linus TorvaldsJan 17, 2008
  20. Johannes SchindelinJan 17, 2008
  21. MikeJan 17, 2008
  22. Johannes SchindelinJan 17, 2008
  23. MikeJan 17, 2008
  24. Johannes SchindelinJan 17, 2008
  25. MikeJan 17, 2008
  26. Johannes SchindelinJan 17, 2008
  27. MikeJan 17, 2008
  28. Johannes SchindelinJan 17, 2008
  29. David SymondsJan 18, 2008
  30. Russ DillJan 22, 2008
  31. Martin LanghoffJan 17, 2008
  32. Andreas EricssonJan 18, 2008
  33. Junio C HamanoJan 16, 2008
  34. Ping YinJan 17, 2008
  35. Linus TorvaldsJan 17, 2008
  36. Dan McGeeJan 16, 2008
  37. MikeJan 16, 2008
  38. Mike KrierJan 16, 2008
  39. MikeJan 16, 2008
  40. Nguyen Thai Ngoc DuyJan 16, 2008
  41. David SymondsJan 16, 2008
  42. MikeJan 16, 2008
  43. Daniel BarkalowJan 16, 2008
  44. Luke LuJan 16, 2008
  45. MikeJan 16, 2008
  46. Sam VilainJan 17, 2008
  47. Daniel BarkalowJan 16, 2008
  48. MikeJan 16, 2008
  49. Johannes SchindelinJan 16, 2008
  50. Bert WesargJan 16, 2008
  51. Wayne DavisonJan 16, 2008
  52. Matthieu MoyJan 16, 2008
  53. Johannes SchindelinJan 16, 2008
  54. Bill LearJan 16, 2008
  55. Matthieu MoyJan 16, 2008
  56. Johannes SchindelinJan 16, 2008
  57. Junio C HamanoJan 16, 2008
  58. Johannes SchindelinJan 16, 2008
  59. Matthieu MoyJan 16, 2008
  60. Johannes SchindelinJan 16, 2008
  61. Jakub NarebskiJan 16, 2008
  62. Brian DowningJan 17, 2008
  63. Randal L. SchwartzJan 17, 2008
  64. Martin LanghoffJan 17, 2008
  65. Randal L. SchwartzJan 17, 2008

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.