Create archive of git repository based on specific branch revision tag or directory

suggest change

It is also possible to create archives of other items than HEAD, such as branches, commits, tags, and directories.

To create an archive of a local branch dev:

git archive --output=archive-dev.zip --prefix=src-directory-name dev

To create an archive of a remote branch origin/dev:

git archive --output=archive-dev.zip --prefix=src-directory-name origin/dev

To create an archive of a tag v.01:

git archive --output=archive-v.01.zip --prefix=src-directory-name v.01

Create an archive of files inside a specific sub directory (sub-dir) of revision HEAD:

git archive zip --output=archive-sub-dir.zip --prefix=src-directory-name HEAD:sub-dir/

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents