11

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

2 Answers 2

14

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

myfile.bin -text

See the manual for more explanation.

Sign up to request clarification or add additional context in comments.

1 Comment

Please clarify that you do not mean the shell variable $PATH. Could be mistaken.
5

While -text in .gitattributes did not worked,

myfile.bin binary

did.

2 Comments

Binary is a shorthand for -crlf -diff
What's the difference between this and -text?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.