snippetbashTip
git archive — Create an archive of files from a tree. More information: <https://git-scm.com/docs/git-archive>.
Viewed 0 times
createcommandtreefilesfromcliarchivegit archive
Problem
How to use the
git archive command: Create an archive of files from a tree. More information: <https://git-scm.com/docs/git-archive>.Solution
git archive — Create an archive of files from a tree. More information: <https://git-scm.com/docs/git-archive>.Create a
.tar archive from the contents of the current HEAD and print it to stdout:git archive {{[-v|--verbose]}} HEADUse the Zip format and report progress verbosely:
git archive {{[-v|--verbose]}} --format zip HEADOutput the Zip archive to a specific file:
git archive {{[-v|--verbose]}} {{[-o|--output]}} {{path/to/file.zip}} HEADCreate a
.tar archive from the contents of the latest commit of a specific branch:git archive {{[-o|--output]}} {{path/to/file.tar}} {{branch_name}}Use the contents of a specific directory:
git archive {{[-o|--output]}} {{path/to/file.tar}} HEAD:{{path/to/directory}}Prepend a path to each file to archive it inside a specific directory:
git archive {{[-o|--output]}} {{path/to/file.tar}} --prefix {{path/to/prepend}}/ HEADCode Snippets
Create a `.tar` archive from the contents of the current `HEAD` and print it to `stdout`
git archive {{[-v|--verbose]}} HEADUse the Zip format and report progress verbosely
git archive {{[-v|--verbose]}} --format zip HEADOutput the Zip archive to a specific file
git archive {{[-v|--verbose]}} {{[-o|--output]}} {{path/to/file.zip}} HEADCreate a `.tar` archive from the contents of the latest commit of a specific branch
git archive {{[-o|--output]}} {{path/to/file.tar}} {{branch_name}}Use the contents of a specific directory
git archive {{[-o|--output]}} {{path/to/file.tar}} HEAD:{{path/to/directory}}Context
tldr-pages: common/git archive
Revisions (0)
No revisions yet.