Re: "git diff" does not show a diff for newly added, binary files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kristoffer Haugsbakk" <code@xxxxxxxxxxxxxxx> writes:

> On Tue, Apr 4, 2023, at 11:58, Thorsten Otto wrote:
>> "git diff" does not show a diff for newly added, binary files
>> […]
>> I expected a binary diff for the new file, just like it is done
>> when comparing two different, already committed revisions.
>
> Do you use `.gitattributes` to get these binary diffs? What does it look like?

The attribute "binary" can be used like this

    *.mybin	binary

to declare that all files with .mybin suffix are to be treated
binary files.  "git diff", "git format-patch", etc. will treat
such a file as "binary".

What they actually do to "binary files" is a different story.  The
internal diff machinery by default shows "Binary files A and B differ"
just like everybody else's "diff" program does, but has an option to
show "binary patch" we invented.  "git diff --binary" enables the option,
and for some commands, the option is enabled by default.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux