GitArchive


Syntax

  • git archive [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>] [-o <file> | --output=<file>] [--worktree-attributes] [--remote=<repo> [ --exec=<git-upload-archive>]] <tree-ish> [<path>...]

Parameters

ParameterDetails
--format=<fmt>Format of the resulting archive: tar or zip. If this options is not given and the output file is specified, the format is inferred from the filename if possible. Otherwise, defaults to tar.
-l, --listShow all available formats.
-v, --verboseReport progress to stderr.
--prefix=<prefix>/Prepend <prefix>/ to each filename in the archive.
-o <file>, --output=<file>Write the archive to <file> instead of stdout.
--worktree-attributesLook for attributes in .gitattributes files in the working tree.
<extra>This can be any options that the archiver backend understands. For zip backend, using -0 will store the files without deflating them, while -1 through -9 can be used to adjust compression speed and ratio.
--remote=<repo>Retrieve a tar archive from a remote repository <repo> rather than the local repository.
--exec=<git-upload-archive>Used with --remote to specify the path to the <git-upload-archive on the remote.
<tree-ish>The tree or commit to produce an archive for.
<path>Without an optional parameter, all files and directories in the current working directory are included in the archive. If one or more paths are specified, only these are included.