Re: I don't want the .git directory next to my code.
- From
- Mike <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.