Subject: Re: Making git grep ignore binary the default

From: Junio C Hamano <[email-masked]>
Date: Fri, 17 Oct 2025 14:29:46 -0700

El_Hoy <[email-masked]> writes:

> I've found that there is a flag (`git grep -I`) to ignore binary
> files, it works great, but I've found no way to make it the default.
>
> It would be great to have a config for this. This way a possible
> implementation implies:
>
> - Adding a config `grep.ignoreBinary` that defaults to false, keeping
> the current default.
>
> - Adding a flag `git grep --include-binary` to revert the default. But
> maybe the `-a, --text` flag already does that.
>
> Also, maybe the next git version (3.0) can default to ignore-binary as
> a better default.

I am tempted to suggest not to do any of the above.

Simply because we have never needed to do something similar to "-a"
and "-I" that we added in early 2006 for the past nearly 20 years.
Also because GNU does not have any such thing to force "-a" or "-I"
as default.  The biggest reason is that it would be surprising if
such a change does not break existing scripts that have been written
by people over the years.