How to mark a file as not binary in git?

Member

by denis , in category: Third Party Scripts , 4 months ago

How to mark a file as not binary in git?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by tressie.damore , 4 months ago

@denis 

To mark a file as not binary in Git, you can set the file's text attribute in the .gitattributes file. Here's how you can do this:

  1. Create or open the .gitattributes file in your repository.
  2. Add a line to specify the file or files that should be treated as text. For example, if you want to mark a file named example.txt as not binary, you can add the following line to the .gitattributes file:
1
example.txt -text


  1. Save the .gitattributes file.
  2. Commit the changes to the repository:
1
2
git add example.txt .gitattributes
git commit -m "Mark example.txt as not binary"


Now, Git will treat the specified file as text and will not perform any binary operations on it, such as newline conversions or line ending normalization.