iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📗

How to create a package excluding Git files for Chrome extension development and more

に公開

The git archive command allows you to create a zip file or similar while excluding files and folders specified in .gitignore, but by default, .gitignore itself is still included. Here is how to exclude it as well.

First, create a .gitattributes file.

.gitattributes
.gitattributes export-ignore
.gitignore export-ignore

By appending export-ignore after the file/folder name, it will be excluded during git archive.

Next, create a bat file to execute git archive.

git_archive.bat
git archive HEAD -o archive.zip

Running this will create a package file archive.zip that completely excludes Git-related files.
Afterward, add archive.zip to your .gitignore and commit it.
If you want to make further adjustments, such as changing the file format from zip to something else, please search for git archive.

Discussion