Back to lessons
Git Archive & Bundle
Package your repository for distribution with git archive, transport commits offline with git bundle, and share patches with format-patch.
Step 1 of 617%
git archive creates a compressed archive (tar or zip) of your repository at a specific commit. Unlike zipping the folder, it only includes tracked files and respects .gitattributes export-ignore rules.
The key advantage of git archive over manual zipping is that it creates a clean snapshot of only the files Git tracks. It automatically excludes the .git directory, untracked files, and anything matched by export-ignore in .gitattributes. This makes it ideal for generating distributable packages — you can add build artifacts to .gitignore and they stay out of the archive, while necessary files are included based on your project configuration.
1 / 6