Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"Export" a git repository to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
@GlulkAlex

This comment has been minimized.

Copy link

GlulkAlex commented Nov 4, 2017

In this case 1-st option can be omitted .

@scofield-ua

This comment has been minimized.

Copy link

scofield-ua commented Feb 8, 2018

git archive -o latest.zip HEAD

Create a Zip archive that contains the contents of the latest commit on the current branch. Note that the output format is inferred by the extension of the output file.

Much simpler, no?

@nitrocode

This comment has been minimized.

Copy link

nitrocode commented Feb 9, 2018

@scofield-ua Helpful if you've already checked out the branch to archive

@sfaleron

This comment has been minimized.

Copy link

sfaleron commented May 28, 2018

I wanted a git clone without the metadata / an uncompressed archive.

git archive --format=tar HEAD | (cd dest; tar -xpf -)

You can probably figure out how to flip the directory dependency to the git side with --remote.

@ck9sky

This comment has been minimized.

Copy link

ck9sky commented Jun 14, 2018

If I understand @sfaleron, I want something similar, except I want to zip my git clone. I think this would involve a zip of .git hidden directory, something that apparently is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.