mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-31 02:35:30 +02:00

Co-authored-by: spageektti <git@spageektti.cc> Co-authored-by: Fazle Arefin <fazlearefin@users.noreply.github.com>
28 lines
903 B
Markdown
28 lines
903 B
Markdown
# 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 {{--verbose|-v}} HEAD`
|
|
|
|
- Use the Zip format and report progress verbosely:
|
|
|
|
`git archive {{--verbose|-v}} --format zip HEAD`
|
|
|
|
- Output the Zip archive to a specific file:
|
|
|
|
`git archive {{--verbose|-v}} {{--output|-o}} {{path/to/file.zip}} HEAD`
|
|
|
|
- Create a tar archive from the contents of the latest commit of a specific branch:
|
|
|
|
`git archive {{--output|-o}} {{path/to/file.tar}} {{branch_name}}`
|
|
|
|
- Use the contents of a specific directory:
|
|
|
|
`git archive {{--output|-o}} {{path/to/file.tar}} HEAD:{{path/to/directory}}`
|
|
|
|
- Prepend a path to each file to archive it inside a specific directory:
|
|
|
|
`git archive {{--output|-o}} {{path/to/file.tar}} --prefix {{path/to/prepend}}/ HEAD`
|