I have a git repo with a bunch of source code, and when that compiles a bunch of binaries are produced. The binaries are all listed in appropriate .gitignore files, and not included in the repo.
However, I would like to distribute a source+binaries snapshot zipfile of my repo that contains all the binaries, but not things like the .git/ directory.
It would seem like the natural way to create a snapshot zipfile would be
git archive -o archive.zip
But that doesn't include any of the binaries which are in .gitignore.
Ideas on how I can accomplish this with git archive? (My work-around is to manually create a zip archive that includes everything other than the .git/ directory)
I don't think you are going to be able to use 'git archive' for what you hope to achieve. 'git archive' works on commits and your binary files simply won't be visible. Note 'git archive' is so commit centric that you can use git archive directly in a bare repository where no source controlled files exist explicitly.
You can exclude files and/or directories from git archive
by using the .gitattributes file.
Edit the file: Each exclusion should have a file pattern followed by "export-ignore":
.gitattributes export-ignore
.gitignore export-ignore
/mytemp export-ignore
Make sure to ignore the .gitattributes file itself!
git archive
won't pick up the settings.Then feel free to use your git archive -o archive.zip
command, or variant.
Source here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With