Use Git Attribute Filter
One possible solution would be to create a specification filter, for example:
#!/bin/bash sed '1s/^\xEF\xBB\xBF//' "$1"
save it somewhere in your path (e.g. removebom
) and make it doable.
Then you need to configure the filter in Git by doing:
$ git config diff.removebom.textconv removebom
and adding an attribute for the files you are interested in (i.e. cpp) to your repository:
*.cpp diff=removebom
as a .gitattributes
file.
More information about the topic can be found at:
Or delete the spec once for all
... because, hopefully, the specification can be deleted once and for all in your project :)
source share