You could probably do this with git’s filter attribute: https://git-scm.com/docs/gitattributes#_filter