Git Archive Master vs Subversion Export

I have been using Subversion for years. Often, I refer to Subversion commands when I have questions with Git. Subversion has an “export” command when you want a copy of the repository without the .svn directories and files. The question is, does Git have an “export” function similar to Subversion? The answer is yes. It’s called “archive master.”

To export in Git, go to the root of your Git project. For example:

$ cd ~/git/project

Create a gzip file or a zip file.

$ git archive master | gzip > project.tgz

or

$ git archive master | zip > project.zip

That’s it. You now a have a compressed copy of your project.

One thought on “Git Archive Master vs Subversion Export

Comments are closed.