1GIT-ARCHIVE(1)                    Git Manual                    GIT-ARCHIVE(1)
2
3
4

NAME

6       git-archive - Create an archive of files from a named tree
7

SYNOPSIS

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

DESCRIPTION

16       Creates an archive of the specified format containing the tree
17       structure for the named tree, and writes it out to the standard output.
18       If <prefix> is specified it is prepended to the filenames in the
19       archive.
20
21       git archive behaves differently when given a tree ID versus when given
22       a commit ID or tag ID. In the first case the current time is used as
23       the modification time of each file in the archive. In the latter case
24       the commit time as recorded in the referenced commit object is used
25       instead. Additionally the commit ID is stored in a global extended pax
26       header if the tar format is used; it can be extracted using git
27       get-tar-commit-id. In ZIP files it is stored as a file comment.
28

OPTIONS

30       --format=<fmt>
31           Format of the resulting archive: tar or zip. If this option is not
32           given, and the output file is specified, the format is inferred
33           from the filename if possible (e.g. writing to "foo.zip" makes the
34           output to be in the zip format). Otherwise the output format is
35           tar.
36
37       -l, --list
38           Show all available formats.
39
40       -v, --verbose
41           Report progress to stderr.
42
43       --prefix=<prefix>/
44           Prepend <prefix>/ to each filename in the archive.
45
46       -o <file>, --output=<file>
47           Write the archive to <file> instead of stdout.
48
49       --worktree-attributes
50           Look for attributes in .gitattributes in working directory too.
51
52       <extra>
53           This can be any options that the archiver backend understands. See
54           next section.
55
56       --remote=<repo>
57           Instead of making a tar archive from the local repository, retrieve
58           a tar archive from a remote repository.
59
60       --exec=<git-upload-archive>
61           Used with --remote to specify the path to the git-upload-archive on
62           the remote side.
63
64       <tree-ish>
65           The tree or commit to produce an archive for.
66
67       path
68           Without an optional path parameter, all files and subdirectories of
69           the current working directory are included in the archive. If one
70           or more paths are specified, only these are included.
71

BACKEND EXTRA OPTIONS

73   zip
74       -0
75           Store the files instead of deflating them.
76
77       -9
78           Highest and slowest compression level. You can specify any number
79           from 1 to 9 to adjust compression speed and ratio.
80

CONFIGURATION

82       tar.umask
83           This variable can be used to restrict the permission bits of tar
84           archive entries. The default is 0002, which turns off the world
85           write bit. The special value "user" indicates that the archiving
86           user’s umask will be used instead. See umask(2) for details.
87

ATTRIBUTES

89       export-ignore
90           Files and directories with the attribute export-ignore won’t be
91           added to archive files. See gitattributes(5) for details.
92
93       export-subst
94           If the attribute export-subst is set for a file then git will
95           expand several placeholders when adding this file to an archive.
96           See gitattributes(5) for details.
97
98       Note that attributes are by default taken from the .gitattributes files
99       in the tree that is being archived. If you want to tweak the way the
100       output is generated after the fact (e.g. you committed without adding
101       an appropriate export-ignore in its .gitattributes), adjust the checked
102       out .gitattributes file as necessary and use --work-tree-attributes
103       option. Alternatively you can keep necessary attributes that should
104       apply while archiving any tree in your $GIT_DIR/info/attributes file.
105

EXAMPLES

107       git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf
108       -)
109           Create a tar archive that contains the contents of the latest
110           commit on the current branch, and extract it in the /var/tmp/junk
111           directory.
112
113       git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip
114       >git-1.4.0.tar.gz
115           Create a compressed tarball for v1.4.0 release.
116
117       git archive --format=tar --prefix=git-1.4.0/ v1.4.0^{tree} | gzip
118       >git-1.4.0.tar.gz
119           Create a compressed tarball for v1.4.0 release, but without a
120           global extended pax header.
121
122       git archive --format=zip --prefix=git-docs/ HEAD:Documentation/ >
123       git-1.4.0-docs.zip
124           Put everything in the current head’s Documentation/ directory into
125           git-1.4.0-docs.zip, with the prefix git-docs/.
126
127       git archive -o latest.zip HEAD
128           Create a Zip archive that contains the contents of the latest
129           commit on the current branch. Note that the output format is
130           inferred by the extension of the output file.
131

SEE ALSO

133       gitattributes(5)
134

AUTHOR

136       Written by Franck Bui-Huu and Rene Scharfe.
137

DOCUMENTATION

139       Documentation by David Greaves, Junio C Hamano and the git-list
140       <git@vger.kernel.org[1]>.
141

GIT

143       Part of the git(1) suite
144

NOTES

146        1. git@vger.kernel.org
147           mailto:git@vger.kernel.org
148
149
150
151Git 1.7.1                         08/16/2017                    GIT-ARCHIVE(1)
Impressum