git archive
Creates an archive (tar or zip) of files from a named tree.
Syntax
git archive [<options>] <tree-ish> [<path>...]
Options
- --format=<fmt>: Specifies the archive format (tar, tar.gz, zip)
- --output=<file> / -o <file>: Writes the archive to a file instead of stdout
- --prefix=<prefix>/: Prepends a prefix to each filename in the archive
- <tree-ish>: The tree or commit to create the archive from (e.g., HEAD, a tag, or a branch)
Example
git archive --format=zip --output=release.zip HEAD git archive --format=tar.gz -o v1.0.tar.gz v1.0.0