1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.4.5" />
7 <title>git-archive(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-archive(
1) Manual Page
409 <div class=
"sectionbody">
411 Create an archive of files from a named tree
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git archive
</em> [--format=
<fmt
>] [--list] [--prefix=
<prefix
>/] [
<extra
>]
419 [-o | --output=
<file
>] [--worktree-attributes]
420 [--remote=
<repo
> [--exec=
<git-upload-archive
>]]
<tree-ish
>
421 [
<path
>…]
</div>
422 <div class=
"verseblock-attribution">
425 <h2 id=
"_description">DESCRIPTION
</h2>
426 <div class=
"sectionbody">
427 <div class=
"paragraph"><p>Creates an archive of the specified format containing the tree
428 structure for the named tree, and writes it out to the standard
429 output. If
<prefix
> is specified it is
430 prepended to the filenames in the archive.
</p></div>
431 <div class=
"paragraph"><p><em>git archive
</em> behaves differently when given a tree ID versus when
432 given a commit ID or tag ID. In the first case the current time is
433 used as the modification time of each file in the archive. In the latter
434 case the commit time as recorded in the referenced commit object is
435 used instead. Additionally the commit ID is stored in a global
436 extended pax header if the tar format is used; it can be extracted
437 using
<em>git get-tar-commit-id
</em>. In ZIP files it is stored as a file
440 <h2 id=
"_options">OPTIONS
</h2>
441 <div class=
"sectionbody">
442 <div class=
"dlist"><dl>
448 Format of the resulting archive:
<em>tar
</em> or
<em>zip
</em>. If this option
449 is not given, and the output file is specified, the format is
450 inferred from the filename if possible (e.g. writing to
"foo.zip"
451 makes the output to be in the zip format). Otherwise the output
452 format is
<tt>tar
</tt>.
463 Show all available formats.
474 Report progress to stderr.
478 --prefix=
<prefix
>/
482 Prepend
<prefix
>/ to each filename in the archive.
489 --output=
<file
>
493 Write the archive to
<file
> instead of stdout.
497 --worktree-attributes
501 Look for attributes in .gitattributes in working directory too.
509 This can be any options that the archiver backend understands.
514 --remote=
<repo
>
518 Instead of making a tar archive from the local repository,
519 retrieve a tar archive from a remote repository.
523 --exec=
<git-upload-archive
>
527 Used with --remote to specify the path to the
528 <em>git-upload-archive
</em> on the remote side.
536 The tree or commit to produce an archive for.
544 Without an optional path parameter, all files and subdirectories
545 of the current working directory are included in the archive.
546 If one or more paths are specified, only these are included.
551 <h2 id=
"_backend_extra_options">BACKEND EXTRA OPTIONS
</h2>
552 <div class=
"sectionbody">
553 <h3 id=
"_zip">zip
</h3><div style=
"clear:left"></div>
554 <div class=
"dlist"><dl>
560 Store the files instead of deflating them.
568 Highest and slowest compression level. You can specify any
569 number from
1 to
9 to adjust compression speed and ratio.
574 <h2 id=
"_configuration">CONFIGURATION
</h2>
575 <div class=
"sectionbody">
576 <div class=
"dlist"><dl>
582 This variable can be used to restrict the permission bits of
583 tar archive entries. The default is
0002, which turns off the
584 world write bit. The special value
"user" indicates that the
585 archiving user
’s umask will be used instead. See umask(
2) for
586 details. If
<tt>--remote
</tt> is used then only the configuration of
587 the remote repository takes effect.
591 tar.
<format
>.command
595 This variable specifies a shell command through which the tar
596 output generated by
<tt>git archive
</tt> should be piped. The command
597 is executed using the shell with the generated tar file on its
598 standard input, and should produce the final output on its
599 standard output. Any compression-level options will be passed
600 to the command (e.g.,
"-9"). An output file with the same
601 extension as
<tt><format
></tt> will be use this format if no other
604 <div class=
"paragraph"><p>The
"tar.gz" and
"tgz" formats are defined automatically and default to
605 <tt>gzip -cn
</tt>. You may override them with custom commands.
</p></div>
608 tar.
<format
>.remote
612 If true, enable
<tt><format
></tt> for use by remote clients via
613 <a href=
"git-upload-archive.html">git-upload-archive(
1)
</a>. Defaults to false for
614 user-defined formats, but true for the
"tar.gz" and
"tgz"
620 <h2 id=
"_attributes">ATTRIBUTES
</h2>
621 <div class=
"sectionbody">
622 <div class=
"dlist"><dl>
628 Files and directories with the attribute export-ignore won
’t be
629 added to archive files. See
<a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
637 If the attribute export-subst is set for a file then git will
638 expand several placeholders when adding this file to an archive.
639 See
<a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
643 <div class=
"paragraph"><p>Note that attributes are by default taken from the
<tt>.gitattributes
</tt> files
644 in the tree that is being archived. If you want to tweak the way the
645 output is generated after the fact (e.g. you committed without adding an
646 appropriate export-ignore in its
<tt>.gitattributes
</tt>), adjust the checked out
647 <tt>.gitattributes
</tt> file as necessary and use
<tt>--worktree-attributes
</tt>
648 option. Alternatively you can keep necessary attributes that should apply
649 while archiving any tree in your
<tt>$GIT_DIR/info/attributes
</tt> file.
</p></div>
651 <h2 id=
"_examples">EXAMPLES
</h2>
652 <div class=
"sectionbody">
653 <div class=
"dlist"><dl>
655 git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/
&& tar xf -)
659 Create a tar archive that contains the contents of the
660 latest commit on the current branch, and extract it in the
661 <tt>/var/tmp/junk
</tt> directory.
665 git archive --format=tar --prefix=git-
1.4.0/ v1.4
.0 | gzip
>git-
1.4.0.tar.gz
669 Create a compressed tarball for v1.4
.0 release.
673 git archive --format=tar.gz --prefix=git-
1.4.0/ v1.4
.0 >git-
1.4.0.tar.gz
677 Same as above, but using the builtin tar.gz handling.
681 git archive --prefix=git-
1.4.0/ -o git-
1.4.0.tar.gz v1.4
.0
685 Same as above, but the format is inferred from the output file.
689 git archive --format=tar --prefix=git-
1.4.0/ v1.4
.0^{tree} | gzip
>git-
1.4.0.tar.gz
693 Create a compressed tarball for v1.4
.0 release, but without a
694 global extended pax header.
698 git archive --format=zip --prefix=git-docs/ HEAD:Documentation/
> git-
1.4.0-docs.zip
702 Put everything in the current head
’s Documentation/ directory
703 into
<em>git-
1.4.0-docs.zip
</em>, with the prefix
<em>git-docs/
</em>.
707 git archive -o latest.zip HEAD
711 Create a Zip archive that contains the contents of the latest
712 commit on the current branch. Note that the output format is
713 inferred by the extension of the output file.
717 git config tar.tar.xz.command
"xz -c"
721 Configure a
"tar.xz" format for making LZMA-compressed tarfiles.
722 You can use it specifying
<tt>--format=tar.xz
</tt>, or by creating an
723 output file like
<tt>-o foo.tar.xz
</tt>.
728 <h2 id=
"_see_also">SEE ALSO
</h2>
729 <div class=
"sectionbody">
730 <div class=
"paragraph"><p><a href=
"gitattributes.html">gitattributes(
5)
</a></p></div>
732 <h2 id=
"_git">GIT
</h2>
733 <div class=
"sectionbody">
734 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
737 <div id=
"footer-text">
738 Last updated
2011-
07-
19 20:
01:
51 UTC