Git ignore BOM (prevent git diff from showing byte order mark changes)
问题 I want git diff to not show BOM changes. Such changes typically show up as <feff> in the diff: -<feff>/*^M +/*^M How can I make git diff to behave this way? Preferably with a command-line parameter. git --ignore-all-space (aka git -w ) does not do the trick. I am on Mac OS X if that matters. 回答1: Use Git Attributes filter One possible solution would be to create a BOM filter such as: #!/bin/bash sed '1s/^\xEF\xBB\xBF//' "$1" store it somewhere in your path (as i.e. removebom ) and make it