Subject: Re: git grep failure?

From: Jeff King <[email-masked]>
Date: Thu, 19 Mar 2026 11:53:26 -0400

On Wed, Mar 18, 2026 at 09:42:23PM -0700, Randy Dunlap wrote:

> > I applied the patch and git-grep does produce one line of output (the
> > instance added by the patch).
> > 
> > Two possible differences:
> > 
> >   - are you sure the patch application succeeded?
> 
> 'git apply filename.patch' succeeded AFAICT. git status shows one
> untracked file (the one that is added by the patch).
> Do I need to do 'git commit' also?

Ah, I see. I used "git am" to apply the patch, which made a commit using
the email as the commit message.

As Junio noted, "git apply" by itself will not mark the file as tracked.
You would need to "git add" it, at which point git-grep would start
looking at it (since it only looks at tracked files). And then "git
commit" if you actually want a commit.

But at that point, you probably want to be using "git am", unless you
don't want to use the sender's commit message for some reason. (Though
even if that is the case, I'd probably use "git am" and then "git commit
--amend" to tweak it).

-Peff