Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active June 30, 2021 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nepsilon/44a2587a086f15d742c6 to your computer and use it in GitHub Desktop.
Save nepsilon/44a2587a086f15d742c6 to your computer and use it in GitHub Desktop.
Export your repo with git archive — First published in fullweb.io issue #16

Export your repo with git archive

See how to use git archive to export your repository. For instance to get a copy of the code at a given commit, tag or branch. Note: it will not include the .git folder, just the code.

Create a Zip archive of the latest commit on the current branch:

$ git archive -o latest.zip HEAD 

Exporting the branch pouet as a tarball:

$ git archive -o branch_pouet.tar pouet

The filetype is inferred from the filename, one of .tar, .tgz, .tar.gz, .zip.

By default git outputs on stdout convenient for piping to anything:

$ git archive master | bzip2 | ssh user@host "cat > master.bz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment