Exporting from a Git Repository

There are many articles on the web that point to the ‘git archive’ command as the way to export files from your repository. The ‘git archive’ command produces some sort of archive such as a zip or tar file. On most occasions I end up immediately extracting the archive to get at the files. Turns out there is a better way to do this. If you just want to export all the files in your repo to another folder use the following command:

git checkout-index -f -a --prefix=C:\path\to\folder\

Make sure you end the path with a ‘\’ otherwise it won’t work. More information on the checkout-index command can be found here.

Author image
About Jacob Hodges