diff options
Diffstat (limited to 'Documentation/git-archive.txt')
| -rw-r--r-- | Documentation/git-archive.txt | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index bc4e76a783..56989a2f34 100644 --- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -49,7 +49,9 @@ OPTIONS Report progress to stderr. --prefix=<prefix>/:: - Prepend <prefix>/ to each filename in the archive. + Prepend <prefix>/ to paths in the archive. Can be repeated; its + rightmost value is used for all tracked files. See below which + value gets used by `--add-file` and `--add-virtual-file`. -o <file>:: --output=<file>:: @@ -57,9 +59,26 @@ OPTIONS --add-file=<file>:: 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 `--prefix` option (if any) + before this `--add-file` and the basename of <file>. + +--add-virtual-file=<path>:<content>:: + Add the specified contents to the archive. Can be repeated to add multiple files. The path of the file in the archive is built - by concatenating the value for `--prefix` (if any) and the - basename of <file>. + by concatenating the value of the last `--prefix` option (if any) + before this `--add-virtual-file` and `<path>`. ++ +The `<path>` 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. ++ +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 `--add-file` instead. --worktree-attributes:: Look for attributes in .gitattributes files in the working tree @@ -194,6 +213,12 @@ EXAMPLES commit on the current branch. Note that the output format is inferred by the extension of the output file. +`git archive -o latest.tar --prefix=build/ --add-file=configure --prefix= HEAD`:: + + Creates a tar archive that contains the contents of the latest + commit on the current branch with no prefix and the untracked + file 'configure' with the prefix 'build/'. + `git config tar.tar.xz.command "xz -c"`:: Configure a "tar.xz" format for making LZMA-compressed tarfiles. |
