Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When you remove an image from git and commit then add the same file back and commit, does git store the image twice?

Tags:

git

image

For example: I remove a large image from the project and commit. I know the image is still saved in there in the history. Later, I'm asked to add the exact same file back into the repo. Does git know it already has that file in the history and use the same data or does it save the large image into the history again?

like image 575
jasongregori Avatar asked Dec 20 '25 07:12

jasongregori


1 Answers

The blob hash should be the same at least but im not sure if and how git might use some kind of delta compression. A tip is to inspect your repository with git ls-tree.

git ls-tree HEAD path/to/image
git ls-tree <older-commit-with-image> path/to/image
like image 137
Mattias Wadman Avatar answered Dec 24 '25 10:12

Mattias Wadman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!