Re: how to git-archive ignore some files?
- From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
- Date
- May 6, 2008, 21:23 UTC
- Message-ID
- <4820CC35.3090202@lsrfire.ath.cx>
- In-Reply-To
- <BAYC1-PASMTP023026B88005E512F95384AED60@CEZ.ICE>
Sean Estabrooks schrieb:
Show 18 quoted lines
> On Tue, 06 May 2008 15:15:31 -0300 > Victor Bogado da Silva Lins <victor@bogado.net> 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é