Subject: Re: how to git-archive ignore some files?

From: René Scharfe <[email-masked]>
Date: Tue, 06 May 2008 23:23:01 +0200

Sean Estabrooks schrieb:
> On Tue, 06 May 2008 15:15:31 -0300
> Victor Bogado da Silva Lins <[email-masked]> wrote:
> 
>> I want to use git-archive to create source packages, but my git
>> repository has a .gitignore that I don't want to be pushed into the
>> archive. So is it possible to keep the .gitignore file in the repository
>> and create an archive(*) without it? 
>>
>> *) using git-archive, off course. 
>>
> 
> Hi Victor,
> 
> You can do something like:
> 
> git archive HEAD  | \
> 	tar --delete .gitignore .mailmap .gitattributes | \
> 	bzip2 -c > archive.tar.bz2

Or, if there is only a small number of files in your repository, you
could do something like this:

   git archive HEAD -- \
      $(git ls-tree -r --name-only HEAD | grep -v '^\.gitignore$')

To really solve this without external tools, git-archive needed to grow
an --exclude option like git-ls-files, though.

René