Book Image

Git Version Control Cookbook

By : Aske Olsson, Rasmus Voss
Book Image

Git Version Control Cookbook

By: Aske Olsson, Rasmus Voss

Overview of this book

Table of Contents (19 chapters)
Git Version Control Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Attributes to export an archive


While exporting a snapshot of a Git repository with the archive command (refer to Chapter 10, Patching and Offline Sharing), it is possible to change the way the archive is made.

Getting ready

We'll use the attributes_example repository:

$ git clone https://github.com/dvaske/attributes_example.git
$ cd attributes_example

How to do it...

First, we'll set up the attributes needed in .gitattributes and commit the file on the exif branch:

$ git checkout exif
Branch exif set up to track remote branch exif from origin by rebasing.
Switched to a new branch 'exif'
$ echo 'europe_needles.jpg export-ignore' >> .gitattributes
$ git add .gitattributes
$ git commit -m 'Add .gitattributes'
[exif 783b7f7] Add .gitattributes
 1 file changed, 1 insertion(+)
 create mode 100644 .gitattributes

Now, we can create an archive from the tip of the exif branch, and the europe_needles.jpg file shouldn't be included, as shown in the following snippet:

$ git archive -o attr.zip exif...