How to export a git repository

When I need to export my code from a git repo, I used to copy my repository to another location and delete git specific stuff from it (.git directory and .gitignore file etc.) and zip the directory.This is a trick that I learned from one of my co-workers. Following command exports your project and creates a tar.gz file from it

git archive master --format=tar --prefix=project_root_directory/| gzip > ~/my_project.tar.gz

run this command on parent of project_root and it will create a zipped version of your project. tar file will include project_root_directory.

blog comments powered by Disqus