Git mark file as binary to avoid line separator conversion

Mot picture Mot · Nov 3, 2011 · Viewed 7.3k times · Source

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

Answer

Josh Lee picture Josh Lee · Nov 3, 2011

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

myfile.bin -text

See the manual for more explanation.