Git (Version Control) - Create an archive (zip gzip bzip2)

If you are not familiar with Git, check out our getting started article. These examples are based on Linux.

The git archive command can be used to create an archive, such as zip, gzip, or bzip2 archive. In this example, a gzip archive named example.tar.gz is created of the master branch of the foo.git repository.

git archive --remote ssh://git@example.com/path/to/foo.git master --format tar.gz --output /path/to/example.tar.gz

 

Or like this.

git archive --remote ssh://git@example.com/path/to/foo.git master | gzip > example.tar.gz

 

Let's say the foo.git repository contains two directories, "foo" and "bar". Here is how you could create an archive of only the "bar" directory.

git archive --remote ssh://git@example.com/path/to/foo.git master bar/ | gzip > example.tar.gz

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 18569 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |