1

The two ways I see used:

picture.jpg binary

and

picture.jpg -text

The former is not officially documented anywhere in the gitattributes documentation page from what I can see. There is some slight mention of it within the context of the diff attribute though (but the diff attribute is not used in these examples directly).

The latter one says "not text", which means it is basically binary, and no EOL normalization is performed.

Are these two functionally the same? What are the differences between the two? Specifically, the former example is the most unknown/confusing for me.

void.pointer
  • 24,859
  • 31
  • 132
  • 243
  • http://stackoverflow.com/a/24978627/6309 and http://stackoverflow.com/a/17883624/6309 can help – VonC Jun 21 '15 at 14:53
  • @VonC Thanks for the links. While the information is in there, the questions asked are within a different context (such as `delta` in the first link). Would be nice to see an answer to my question here that is more focused, because the answer to my specific question is rather hidden in the links you provided. There is a relevant snippet from the gitattributes docs (linked in my question): http://i.imgur.com/VyiUVZW.png – void.pointer Jun 21 '15 at 15:26

1 Answers1

3

In the Git docs, it states that marking a file as binary is equivalent to marking it as -diff -merge -text:

The built-in macro attribute "binary" is equivalent to:

[attr]binary -diff -merge -text

So, if all you want to do is avoid CRLF processing, go with -text; using binary will make diffs somewhat useless. For something like a .jpg, though, you want to use binary.

Community
  • 1
  • 1
David Deutsch
  • 17,443
  • 4
  • 47
  • 54