I have a git repository that has a UTF-16 file in it. Its only UTF-16 by accident, the file could be encoded in 7-bit ascii without a loss of data. I’d like to use something like reposurgeon to convert the file to UTF-8 so that git diff will work with older revisions of the file and I don’t have to resort to git difftool. Is this possible?
Share
Why don’t you just covert the file to UTF-8 and commit it, e.g. with:
Update after a clarifying comment:
If you want to rewrite that file at every commit in the history of
HEAD, you can usegit filter-branch, something like:Of course, if you’re rewriting history in this way, it may cause problems if you have shared this repository with anyone. (I haven’t tested that command – use it with care, probably only a new clone of your repository.)