Andrey Yaskulsky Andrey Yaskulsky - 4 months ago 29
Git Question

mark folder as binary in .gitattributes

I have to include some folder to a repository but I don't want my git to modify it's content (line endings etc)

I already have some files that are marked as binary files in .gitattributes i.e. images:

*.png binary


but this rule specifies certain category of files - png files, however I want to achieve something like that:

/folder_which_i_want_to_mark_as_binary binary

Answer

In order to fix line endings you can apply following instructions

UNIX System

git config --global core.autocrlf input

Windows System

git config --global core.autocrlf true

If you want to treat as binary everything in a particular folder, in .gitattributes you could add

folder/* binary 

Note: folder must be the name of your folder.