'\" t .\" Title: git-archive .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 10/07/2024 .\" Manual: Git Manual .\" Source: Git 2.47.0 .\" Language: English .\" .TH "GIT\-ARCHIVE" "1" "10/07/2024" "Git 2\&.47\&.0" "Git Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" git-archive \- Create an archive of files from a named tree .SH "SYNOPSIS" .sp .nf \fIgit archive\fR [\-\-format=] [\-\-list] [\-\-prefix=/] [] [\-o | \-\-output=] [\-\-worktree\-attributes] [\-\-remote= [\-\-exec=]] [\&...] .fi .sp .SH "DESCRIPTION" .sp Creates an archive of the specified format containing the tree structure for the named tree, and writes it out to the standard output\&. If is specified it is prepended to the filenames in the archive\&. .sp \fIgit archive\fR behaves differently when given a tree ID as opposed to a commit ID or tag ID\&. When a tree ID is provided, the current time is used as the modification time of each file in the archive\&. On the other hand, when a commit ID or tag ID is provided, the commit time as recorded in the referenced commit object is used instead\&. Additionally the commit ID is stored in a global extended pax header if the tar format is used; it can be extracted using \fIgit get\-tar\-commit\-id\fR\&. In ZIP files it is stored as a file comment\&. .SH "OPTIONS" .PP \-\-format= .RS 4 Format of the resulting archive\&. Possible values are \fBtar\fR, \fBzip\fR, \fBtar\&.gz\fR, \fBtgz\fR, and any format defined using the configuration option \fBtar\&.\&.command\fR\&. If \fB\-\-format\fR is not given, and the output file is specified, the format is inferred from the filename if possible (e\&.g\&. writing to \fBfoo\&.zip\fR makes the output to be in the \fBzip\fR format)\&. Otherwise the output format is \fBtar\fR\&. .RE .PP \-l, \-\-list .RS 4 Show all available formats\&. .RE .PP \-v, \-\-verbose .RS 4 Report progress to stderr\&. .RE .PP \-\-prefix=/ .RS 4 Prepend / to paths in the archive\&. Can be repeated; its rightmost value is used for all tracked files\&. See below which value gets used by \fB\-\-add\-file\fR\&. .RE .PP \-o , \-\-output= .RS 4 Write the archive to instead of stdout\&. .RE .PP \-\-add\-file= .RS 4 Add a non\-tracked file to the archive\&. Can be repeated to add multiple files\&. The path of the file in the archive is built by concatenating the value of the last \fB\-\-prefix\fR option (if any) before this \fB\-\-add\-file\fR and the basename of \&. .RE .PP \-\-add\-virtual\-file=: .RS 4 Add the specified contents to the archive\&. Can be repeated to add multiple files\&. .sp The \fB\fR argument can start and end with a literal double\-quote character; the contained file name is interpreted as a C\-style string, i\&.e\&. the backslash is interpreted as escape character\&. The path must be quoted if it contains a colon, to avoid the colon from being misinterpreted as the separator between the path and the contents, or if the path begins or ends with a double\-quote character\&. .sp The file mode is limited to a regular file, and the option may be subject to platform\-dependent command\-line limits\&. For non\-trivial cases, write an untracked file and use \fB\-\-add\-file\fR instead\&. .sp Note that unlike \fB\-\-add\-file\fR the path created in the archive is not affected by the \fB\-\-prefix\fR option, as a full \fB\fR can be given as the value of the option\&. .RE .PP \-\-worktree\-attributes .RS 4 Look for attributes in \&.gitattributes files in the working tree as well (see the section called \(lqATTRIBUTES\(rq)\&. .RE .PP \-\-mtime=