I have a project in git with a bunch of graphics (.jpg, .png, .tiff, etc). The graphics extensions are in my .gitignore (this can change) because I do not need to version the graphics (the department responsible for graphics has version cue and tracks their own changes to the graphics). However, when I push, it seems only the tracked content gets to the repository. I need the graphics to be pushed with the repository, but I do not want to track the graphics files, how would I do this (or is it even possible)?
-
Whenever the graphics change, do you want to push them as well? – carl Sep 08 '09 at 19:05
-
@cvondrick Yes, but I just overwrite the graphics files-- since the git repository is on our local LAN, it would be acceptable to just push all untracted graphics files. I just don't want to bloat up my archive with graphics. – Mica Sep 08 '09 at 20:24
-
Try looking at http://stackoverflow.com/questions/250238/collapsing-a-git-repositorys-history – Will Bickford Sep 08 '09 at 21:49
-
@Will -- that is a good link. He says his "bloated" archive is about 200mb... my "bloated" archive is currently at 800mb. – Mica Sep 08 '09 at 22:32
4 Answers
Tracked files are files that should go in the repository, so if you want the graphics in the repository, you want them tracked.
Also--while the department doing the graphics may track their changes to the files, you'll want to track the graphics file that you're using with the project, which is different. Tracking those for your project with git accomplishes that.

- 108,630
- 30
- 201
- 202
-
I am trying to keep my repository size from bloating up due to storing the binary graphics files. There are a few thousand graphics files, and its only important to have the most recent version of these files. – Mica Sep 08 '09 at 20:37
You can't push unless it's tracked.
Are you using the push as a deployment step? If so you either want to track the graphics files in order to push them. Or you want a seperate deployment step for the graphics files. Personally I'd just add the graphics files to the repo. Disk space is cheap.

- 23,907
- 5
- 55
- 73
-
1+1 for "Disk space is cheap", I was going to say exactly the same thing. – Greg Hewgill Sep 08 '09 at 21:52
You can add files to repository even if they are ignored (match pattern in .gitignore
).
You can push with git only what is comitted, so you can't push (using git) untracked files. You can use other mechanizm like rsync or scp instead (if it is on other server).

- 309,089
- 65
- 217
- 230
-
so perhaps a git push followed by an rsync command to sync untracked content would be the best way to go? That doesn't sound too difficult. – Mica Sep 08 '09 at 22:41
Depending on your project, if you have a large number of those graphics, you may want to keep all those images in a database table. That's what BLOBs are for.

- 11,053
- 6
- 44
- 48