How to clean files in Git history?

Hi all;

I’ve been using Git as a version control and backup tool, as well as for collaborative work. I installed Gitlab on my server, and have been using it for a long time.

However I recently realized that my repo is over 10 GB, and I think at this rate it will go over 30. But I know there are many big files in there that won’t be used, like old lightmap data, or removed big scens. At one point I had a scene that was over 100 MB, now it is not used anymore and its counterparts are 5 mb at most.

How can I remove these files from repo and history? I need to get the size down. Or should I have approached differently from start, never commit something that is not finished? How do you cope with this? Because it gets impossible to use Bitbucket etc.

Regards, Tansel.

Not sure about git, but I know that SVN does not have this feature either, but Perforce does. It’s called “obliterate”. Perhaps there’s a similar command?

I’ve been looking around and there are too many different solutions, but not what I would wanted.
An easy solution is to have a milestone and remove the repo, then commit everything and start from scratch. However, it loses the point of having a change history.

Well, it wouldn’t be a complete loss. At your milestone (ideally end of project), the last SVN archive that you do can be stored away, and recovered in a separate repo if you really need to see history. Yeah, it’d be a hassle though.

Yeah, you are right. Thanks for the suggestion.
I don’t really want to go that way, but if it comes to that I’ll do that.

I tried git gc and even with --aggressive, but no avail. Repo size is still too big.