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
The currently accepted answer did not work for me. Possibly the behavior changed in recent versions of git. Quoting from the manual of gitattributes:
The rules by which the pattern matches paths are the same as in .gitignore files (see gitignore[5]), with a few exceptions:
- negative patterns are forbidden
- patterns that match a directory do not recursively match paths inside that directory (so using the trailing-slash path/ syntax is pointless in an attributes file; use path/** instead)
Therefore, to treat a whole folder as binary, use the following syntax:
folder_which_i_want_to_mark_as_binary/** binary
Tested with git version 2.20.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With