In my Git repository I've got quite a lot of images (changing to other VCS then Git is out of the question). Part of the images, are duplicates with a different size, these are created by ImageMagick. From time to time, I have to regenerate the images, which is ok, however, even though the image itself didn't change [size is the same etc] git marks this file as modified. I assume this is because of last modified dates, is that right? Is there any chance, I could change the way git tracks changes of images? Is there anyway to add ImageMagick's compare functionality?
Asked
Active
Viewed 1,330 times
1 Answers
2
Edited
I was wrong, git avoid checking the file content and prefer using faster methods as described in the related post: How does git detect that a file has been modified?
If your files are not modified, I'm not sure if I understand well, but maybe using git update-index --assume-unchanged
might help.
However that does not mean your files are not modified when you re-run the generation step, and you should check for yourself with git diff
or follow advices of the post How can I diff binary files in git?
But I think the problem does not lie with git
and it would be better to review your work-flow.
I can see two options:
- either you do not re-generate the images if it's not needed and by doing so you avoid the problem
- or you do not track the binary files in git and generate them on the target
-
Thanks bufh, you are right, I didn't think of the meta. This is how I generate them: `${imgAnimationsDir}/*.jpg -resize 50% -set filename:fname '%t-sd.%e' +adjoin '${imgAnimationsDir}/%[filename:fname]'` – Krystian Aug 05 '15 at 10:11
-
Is there any way I could get to know on what basis git decided the file was modified? – Krystian Aug 05 '15 at 10:13