Linux "git-archive" Command Line Options and Examples
Create an archive of files from a named tree

Creates an archive of the specified format containing the tree structure for the named tree, and writes it out to the standard output. If <prefix> is specified it is prepended to the filenames in the archive. git archive behaves differently when given a tree ID versus when given a commit ID or tag ID.


Usage:

git archive [--format=] [--list] [--prefix=/] []
[-o | --output=] [--worktree-attributes]
[--remote= [--exec=]]
[...]






Command Line Options:

--format
Format of the resulting archive: tar or zip. If this option is not given, and the output file is specified, the format isinferred from the filename if possible (e.g. writing to "foo.zip" makes the output to be in the zip format). Otherwise the outputformat is tar.
git-archive --format ...
-l
Show all available formats.
git-archive -l ...
-v
Report progress to stderr.
git-archive -v ...
--prefix
Prepend <prefix>/ to each filename in the archive.
git-archive --prefix ...
-o
Write the archive to <file> instead of stdout.
git-archive -o ...
--worktree-attributes
Look for attributes in .gitattributes files in the working tree as well (see the section called “ATTRIBUTES”).<extra>This can be any options that the archiver backend understands. See next section.
git-archive --worktree-attributes ...
--remote
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository. Note that the remoterepository may place restrictions on which sha1 expressions may be allowed in <tree-ish>. See git-upload-archive(1) for details.
git-archive --remote ...
--exec
Used with --remote to specify the path to the git-upload-archive on the remote side.<tree-ish>The tree or commit to produce an archive for.<path>Without an optional path parameter, all files and subdirectories of the current working directory are included in the archive. Ifone or more paths are specified, only these are included.BACKEND EXTRA OPTIONSzip
git-archive --exec ...
-0
Store the files instead of deflating them.
git-archive -0 ...
-9
Highest and slowest compression level. You can specify any number from 1 to 9 to adjust compression speed and ratio.CONFIGURATIONtar.umaskThis variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the worldwrite bit. The special value "user" indicates that the archiving user’s umask will be used instead. See umask(2) for details. If
git-archive -9 ...