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


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 --prefix=src-directory-name dev

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

git archive --prefix=src-directory-name origin/dev

To create an archive of a tag v.01:

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

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

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