I'm working on a couple of game development projects that involve lots of changes to code and large binary files at the same time. For the sake of simplicity, let's say I have a git repository with 2 files (a text file and a large binary blob) in it that are both updated across multiple commits:
commit dddd: "Release day is finally here!" <tag: v1.0>
changed hello.md
changed image.png (lfs) <==== keeper!
commit cccc: "Ok, that's a bit better."
changed hello.md
changed image.png (lfs)
commit bbbb: "Updated my project."
changed hello.md
changed image.png (lfs)
commit aaaa: "Initial commit!"
added hello.md
added image.png (lfs) <==== keeper!
Each commit I've made some kind of change to both of my files.
But, in retrospect, I've decided that I want to get rid of some lfs files to reduce the overall size of my repository, and only half of the versions of image.png
are different enough to be worth keeping. (Keep in mind, it's not always as simple as not committing the intermediate versions, since we don't always know what the 'key' versions are without hindsight.)
So, can I completely remove the versions of image.png
included in bbbb
and cccc
from my repository to reduce it's overall storage footprint? How? I've been looking into git gc
and git filter-repo
but I've been having trouble achieving what I want to do. Am I on the right track? Are there any other strategies that I can use to optimize the size of my repository or otherwise mitigate this situation?