Archive your Git repo easily

I’ve just had to back up a load of Git repositories, and it got pretty annoying tapping in their names every time. You can use this command to zip up your repository into a tar file that will sit next to your repo.

git archive HEAD | gzip > $PWD\.tar\.gz

So if your repository is at ~/User/Project/my_project/.git/ the zipped version will live at ~/User/Project/my_project.tar.gz. It’s a bit easier.