Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make git ignore UTF-8 BOM when commit?

Tags:

git

I have some UTF-8 encoded text file, is it possible to make git to ignore the UTF-8 BOMs when commit? I know git can auto convert different EOLs ("\r", "\n", "\r\n"), but can I make git to ignore the BOMs and only commit the file contents?

PS: I already have a tool to remove text files's UTF-8 BOMs, but it's inconvenient, I have to run it every time before I commit, it will be more convenient if there's a way to make git to auto process the BOMs.

like image 222
EFanZh Avatar asked Apr 03 '13 07:04

EFanZh


People also ask

What is bom in git?

GitBOM is a minimalistic scheme for build tools to: Build a compact Artifact Dependency Graph (ADG), tracking every source code file incorporated into each built artifact.


1 Answers

Use the pre-commit hook, which is designed for such a purpose.

like image 83
user4815162342 Avatar answered Sep 28 '22 02:09

user4815162342