Mot
Mot

Reputation: 29600

Git mark file as binary to avoid line separator conversion

I have a text file with sample data which I want to put under Git control (on Windows). How can I tell Git to treat this file as binary, so it does not convert line separators (like for the other/text files in the repository).

Upvotes: 11

Views: 7856

Answers (2)

Josh Lee
Josh Lee

Reputation: 177885

Write this in .gitattributes (in the file’s directory or higher up):

myfile.bin -text

See the manual for more explanation.

Upvotes: 14

Cwt
Cwt

Reputation: 8606

While -text in .gitattributes did not worked,

myfile.bin binary

did.

Upvotes: 5

Related Questions