git add file to archive

317 views Asked by At

When I run this command, the files of my latest commit are saved to a ZIP.

git archive -o ../code_version0.9.zip HEAD 

However the files in node_modules and build/ are missing.

That Is because my .gitignore is the following one:

node_modules
build/

How can I ignore files, but Include them In the archive? I looked into the documentation for .gitattributes but I couldn't find a include statement.

1

There are 1 answers

0
Michael Adam On BEST ANSWER

As far as my knowledge goes, git archive only archives files tracked by git, and .gitignore only ignores untracked files. Hence you will never manage to git archive files that are in your .gitignore. Or what am I missing?