When deploying code I by now almost always use git archive
for that no matter whether that is library code or actually product code that gets deployed onto a (web)server.
Recently I had a chat with someone that so far hadn’t heard of that so I realized perhaps it’s time to write about it.
What is it
git archive
is a tool that exports the content of a git repository into an archive file. But while doing so it also uses information in a .gitattributes
file to decide whether to include a file into the archive or not and also whether to modify a file.
A lot of people already know about the .gitattributes
file as it makes sure that certain files are removed from the archive that is created by github when creating a release.
The documentation for .gitattributes
has (amongst a huge number of other information and awesome things that can be done via that file – but that’s for some other time) a special part about creating archives that talks about two attributes: