git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <code@khaugsbakk.name>
Cc: "Thorsten Otto" <admin@tho-otto.de>, git@vger.kernel.org
Subject: Re: "git diff" does not show a diff for newly added, binary files
Date: Tue, 04 Apr 2023 08:42:25 -0700	[thread overview]
Message-ID: <xmqqjzyr3b8e.fsf@gitster.g> (raw)
In-Reply-To: <8135fc7b-1953-4702-a9c4-b0f847e69887@app.fastmail.com> (Kristoffer Haugsbakk's message of "Tue, 04 Apr 2023 12:17:43 +0200")

"Kristoffer Haugsbakk" <code@khaugsbakk.name> 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.

  parent reply	other threads:[~2023-04-04 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  9:58 "git diff" does not show a diff for newly added, binary files Thorsten Otto
2023-04-04 10:17 ` Kristoffer Haugsbakk
2023-04-04 10:39   ` Thorsten Otto
2023-04-04 10:45     ` Kristoffer Haugsbakk
2023-04-04 11:23       ` Thorsten Otto
2023-04-04 11:29         ` Kristoffer Haugsbakk
2023-04-04 15:36     ` Jeff King
2023-04-04 15:42   ` Junio C Hamano [this message]
2023-04-04 15:37 ` Junio C Hamano
2023-04-04 15:39 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqjzyr3b8e.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=admin@tho-otto.de \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).