I have a particular need for git to treat most file extensions as binary except a few extensions.
I'd like to treat all file extensions as binary, .pdf .doc .xls etc., except plain text files such as .txt .rb .py etc.
I've tried configuring .gitattributes like below to see how this might work:
# cat .gitattributes
* binary
*.txt text
I thought perhaps the order in the configuration file would matter but it doesn't appear to. With the above configuration all files are still treated as binary.
Is there a way to configure .gitattributes or git any other way to treat all files one way, as binary, except for a few exceptions?
Update 1:
I tried the .gitattributes described below. It works!
# cat .gitattributes
*.txt crlf diff
* binary
# git diff
diff --git a/file b/file
index d929b94..bee5cb1 100644
Binary files a/file and b/file differ
diff --git a/file.txt b/file.txt
index 632ae98..93d22b0 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +1,3 @@
Hey this is a .txt file
+Adding another line
+A new line
Update 2:
I believe crlf and text are the same i.e. the two below configurations for .gitattributes are the same:
# cat .gitattributes
*.txt crlf diff
* binary
# cat .gitattributes
*.txt text diff
* binary