@@ -49,17 +49,19 @@ OPTIONS
49
49
Report progress to stderr.
50
50
51
51
--prefix=<prefix>/::
52
- Prepend <prefix>/ to each filename in the archive.
52
+ Prepend <prefix>/ to paths in the archive. Can be repeated; its
53
+ rightmost value is used for all tracked files. See below which
54
+ value gets used by `--add-file`.
53
55
54
56
-o <file>::
55
57
--output=<file>::
56
58
Write the archive to <file> instead of stdout.
57
59
58
60
--add-file=<file>::
59
61
Add a non-tracked file to the archive. Can be repeated to add
60
- multiple files. The path of the file in the archive is built
61
- by concatenating the value for `--prefix` (if any) and the
62
- basename of <file>.
62
+ multiple files. The path of the file in the archive is built by
63
+ concatenating the value of the last `--prefix` option (if any)
64
+ before this `--add-file` and the basename of <file>.
63
65
64
66
--worktree-attributes::
65
67
Look for attributes in .gitattributes files in the working tree
@@ -194,6 +196,12 @@ EXAMPLES
194
196
commit on the current branch. Note that the output format is
195
197
inferred by the extension of the output file.
196
198
199
+ `git archive -o latest.tar --prefix=build/ --add-file=configure --prefix= HEAD`::
200
+
201
+ Creates a tar archive that contains the contents of the latest
202
+ commit on the current branch with no prefix and the untracked
203
+ file 'configure' with the prefix 'build/'.
204
+
197
205
`git config tar.tar.xz.command "xz -c"`::
198
206
199
207
Configure a "tar.xz" format for making LZMA-compressed tarfiles.
0 commit comments