Git ignore specification (disable Git diff from showing byte order changes)

I want git diff not to show specification changes .
Such changes are usually displayed as <feff> in diff:

 -<feff>/*^M +/*^M 

How can I make git diff behave this way?
Preferably with a command line switch.

git --ignore-all-space (aka git -w ) does not do this trick. I am on Mac OS X if that matters.

+6
source share
1 answer

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 :)

+2
source

Source: https://habr.com/ru/post/978924/


All Articles