From 7c681eea51f59c42391e0eacd3f4d91f19552bd7 Mon Sep 17 00:00:00 2001 From: Guido Lena Cota Date: Wed, 30 Sep 2020 13:18:23 +0200 Subject: [PATCH] git-archive: add page (#4362) --- pages/common/git-archive.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pages/common/git-archive.md diff --git a/pages/common/git-archive.md b/pages/common/git-archive.md new file mode 100644 index 000000000..84eb2a390 --- /dev/null +++ b/pages/common/git-archive.md @@ -0,0 +1,28 @@ +# git archive + +> Create an archive of files from a named tree. +> More information: . + +- Create a tar archive from the contents of the current HEAD and print it to standard output: + +`git archive --verbose HEAD` + +- Create a zip archive from the current HEAD and print it to standard output: + +`git archive --verbose --format=zip HEAD` + +- Same as above, but write the zip archive to file: + +`git archive --verbose --output={{path/to/file.zip}} HEAD` + +- Create a tar archive from the contents of the latest commit on a specific branch: + +`git archive --output={{path/to/file.tar}} {{branch_name}}` + +- Create a tar archive from the contents of a specific directory: + +`git archive --output={{path/to/file.tar}} HEAD:{{path/to/directory}}` + +- Prepend a path to each file to archive it inside a specific directory: + +`git archive --output={{path/to/file.tar}} --prefix={{path/to/prepend}}/ HEAD`