

You might be able to achieve what you want with pre-commit git hooks. You might be able to write a pre-commit script that converts your loseless files to lossy before commiting them to the git repo.
A quick googling gave me this demo python pre-commit hook guide, but I’m sure you can write it in other languages if you’d like, could probably even use a shell script I would think.
https://dev.to/jalvaradosegura/create-your-own-pre-commit-hook-3kh
Wow, TIL, I never heard of git smudge/clean, or git large filesystem I’m not OP, but just amazed about another corner of git I hadn’t known about.