Cleaner Archives For Better Deployments

Nashwan Doaqan
1 min readJul 25, 2019
Motorcycle with many packages

Not all files in your project might be necessary for deployment or exporting. Files such as help documents, unit tests, and 3rd-party services configuration files, .etc., can contain accessible, sensitive information that puts your project at risk.

Getting rid of all unnecessary files manually upon creating the archive is risky and tiresome. However, VCS systems usually have a feature that packages the project automatically. Git, for instance, has a git archive command that creates an archive for your repository. This archive can be customized to exclude specific files or directories by using the .gitattributes configuration file.

Here’s a sample .gitattributes file which shows you some files and directories you might want to exclude from your archive:

Now, when you run `git archive` command, you’ll get a cleaner dist-release archive generated quickly and ready to be shared or deployed.

--

--