# git log -S doesn't search stash WIPs

3 messages from 2008-02-08 to 2008-02-09. Participants: Jonathan del Strother, Johannes Schindelin.
Thread: https://gitlist.dev/t/11967

## Jonathan del Strother, 2008-02-08 10:46

Subject: git log -S doesn't search stash WIPs
Message-ID: <57518fd10802080246p4a929b62tc6e260a16d3587@mail.gmail.com>
URL: https://gitlist.dev/e/57518fd10802080246p4a929b62tc6e260a16d3587%40mail.gmail.com

```
"git log --all -Sfoo" doesn't find strings introduced in stash WIP
commits, only the stash index.  That is, if I do :

$ echo foo >> file
$ git add file
$ echo bar >> file
$ git stash
Saved working directory and index state "WIP on master: 00495fc... initial"
(To restore them type "git stash apply")
HEAD is now at 00495fc... initial
$ git log --all -Sfoo
commit a8834ce80ebdf84e6579280c1fc75cdb7b4ac7c9
Author: Jonathan del Strother <me@here.com>
Date:   Fri Feb 8 10:43:44 2008 +0000

    index on master: 00495fc... initial
$ git log --all -Sbar
<this space intentionally left blank>


Is this intentional?  Am I missing some git-log option that would
allow me to search the stash WIPs?

```

## Johannes Schindelin, 2008-02-08 12:18

Subject: Re: git log -S doesn't search stash WIPs
Message-ID: <alpine.LSU.1.00.0802081208580.11591@racer.site>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0802081208580.11591%40racer.site
In-Reply-To: <57518fd10802080246p4a929b62tc6e260a16d3587@mail.gmail.com>

```
Hi,

On Fri, 8 Feb 2008, Jonathan del Strother wrote:

> "git log --all -Sfoo" doesn't find strings introduced in stash WIP
> commits, only the stash index.

It is a little unfortunate that a stash will do this:

HEAD ------- stash
    \       /
      index

In other words, the index will be "committed" as a regular commit, but the 
working directory will actually be a "merge commit".

So you need to add "--cc" to see the commit.

Further, the stash is not just a branch.  The stash is actually a stack of 
reflogs.  So could you try again, with

	$ git log --cc -Sfoo --walk-reflogs stash

?

Hth,
Dscho

```

## Jonathan del Strother, 2008-02-09 15:18

Subject: Re: git log -S doesn't search stash WIPs
Message-ID: <57518fd10802090718w2ab705aeg6cb1c531666d52a2@mail.gmail.com>
URL: https://gitlist.dev/e/57518fd10802090718w2ab705aeg6cb1c531666d52a2%40mail.gmail.com
In-Reply-To: <alpine.LSU.1.00.0802081208580.11591@racer.site>

```
On Feb 8, 2008 12:18 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 8 Feb 2008, Jonathan del Strother wrote:
>
> > "git log --all -Sfoo" doesn't find strings introduced in stash WIP
> > commits, only the stash index.
>
> It is a little unfortunate that a stash will do this:
>
> HEAD ------- stash
>     \       /
>       index
>
> In other words, the index will be "committed" as a regular commit, but the
> working directory will actually be a "merge commit".
>
> So you need to add "--cc" to see the commit.
>
> Further, the stash is not just a branch.  The stash is actually a stack of
> reflogs.  So could you try again, with
>
>         $ git log --cc -Sfoo --walk-reflogs stash


Hmmm, I'm a little fuzzy on why --cc helps, though it looks like
either or both of --cc and --walk-reflogs will do the trick.
Thanks for the help
Jon

```
