How to do it...

We'll start by creating an archive of the directory structure on the latest commit on the master branch. The offline-sharing repository is checked out on the develop branch by default, so we'll use the reference origin/master to specify the ref for the archive:

$ git archive --prefix=offline/ -o offline.zip origin/master

The --prefix option prepends the specified prefix to each file in the archive, effectively adding an offline directory as a root directory for the files in the repository, and the -o option tells Git to create the archive in the offline.zip file, which of course, is compressed in the ZIP format. We can investigate the ZIP archive to check whether the files contain the following:

$ unzip -l offline.zip
  Archive: ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.