This is a brief note on how to export the last revision of your git repository to a directory or archive file.

For instance, lets say you have already the latest version of your website in the last commit on you git repo and now you would like to deploy the files from the repo to the live website folder directory on your Apache server, run the following

git archive master | tar -x -C ~/mysite


git archive myCustomBranch | tar -x -C ~/mysite - if you want to export/archive a different branch

If instead you would like to export the files into an archive you can run

git archive master | bzip2 >source-tree.tar.bz2

for ZIP archives:

git archive --format zip --output /full/path/to/ master

git help archive for more details, if you need extra details or help.


Popular Links