badsyntax
badsyntax

Reputation: 9650

Versioning image sprites in a git repository

Imagine this scenario:

We have a massive repository, with many different features branches. Each of the feature branches uses one large sprite image. This large sprite image might be slightly different in each feature branch. Feature branches might be merged into different release candidate branches, and then back into master, at different points.

Git cannot version this image (eg, merge changes to the image), and so we are struggling to find an approach to manage this.

One approach is to always keep a 'master' PSD of the sprite image. Whenever a new image is needed to be added to the sprite, a developer would first update the PSD master document, then export the new sprite image. This will ensure the sprite image will always contain all changes. But obviously this sprite image will contain changes we might not want in the different branches (eg, a change to an image within the sprite).

Essentially we need to be able to version this sprite image. Git is not the tool to help us with this, but we need the image to be versioned with the code.

How does one generally manage versioning of images in a git respository?

Upvotes: 3

Views: 406

Answers (1)

Mark Rushakoff
Mark Rushakoff

Reputation: 258388

Don't check in the compiled sprite image; instead, check in the individual images and programmatically build the sprite. Sprite Factory is a tool I've successfully used in the past to build sprite sheets out of individual images. It says it's intended for CSS use, but it can easily provide sprite offsets and dimensions for uses outside the web too.

Upvotes: 3

Related Questions