Re: How to find a commit that introduces (not removes) a string?

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

 



Sebastian Schuberth <sschuberth@xxxxxxxxx> writes:

> Hi all,
>
> I know about git log's -S / -G, but I'm unable to make these search through *introduced* strings only. Is there a way to do so?

This appears to work:

$ for ref in `git log -SWORD --pretty=format:"%h"` ; do 
    git log -1 -p $ref | grep WORD | grep -E '^[+]' > /dev/null ; 
    if [ $? -eq 0 ]; then 
        echo $ref; 
    fi ;
  done

substitute WORD for what you're looking for.  Note that it is repeated
twice.

> Thanks!
>
> PS: I also read [1], but although the author claims to be interested in introduced strings only, he seems to be satisfied with -G, which slightly puzzles me.
>
> [1] http://stackoverflow.com/questions/5816134/git-finding-a-commit-that-introduced-a-string

-- 
Cheers
~vijay
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]