• 0

Export your git branch to a zip folder

Today I found myself in a situation where my git host was down and I wanted to share my project with a colleague. The easiest way to do so is to use the git archive command to export the branch to a zip file. NOTE: This exports the HEAD on the branch specified but not the branch history
git archive --format zip --output "output.zip" master
If you need the branch history, just use the regular zip command and zip your .git directory On Ubuntu, you can go to your project directory, then do the following
zip -r my_roject.zip .git
To use the zip file, copy it to another directory, and do the following
unzip my_project.zip -d my_project_copy
cd my_project_copy
git reset --hard HEAD