Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell Git that settings.html is text, not binary

Tags:

git

Win7, git 1.8.3.1 (from git-scm.org).

I have a settings.html file that git thinks is binary. When I do a diff between branches, I see:

[master]> git diff master work2
diff --git a/settings.html b/settings.html
index 2e46976..620dff4 100644
Binary files a/settings.html and b/settings.html differ

I have tried saving, committing, and pushing settings.html as

  • Unicode (UTF-8 with signature) -- Codepage 65001
  • UTF-8, no signature
  • US-ASCII codepage 20127

No joy; git thinks this one html file is binary.
How can I get git to treat this -- and all html files -- as text?
(I suspect VS2012 is muddying the waters, but the other html/css/js files in the project are treated as text.)

Thanks for any insight...

like image 680
Number8 Avatar asked Dec 05 '25 07:12

Number8


1 Answers

Add the following to a file called .gitattributes in the root of your repo:

*.html text

See gitattributes(5) for more information.

like image 51
Peter Lundgren Avatar answered Dec 07 '25 20:12

Peter Lundgren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!