Re: How to find a commit that introduces (not removes) a string?
- From
- Neal Kreitzinger <nkreitzinger@gmail.com>
- Date
- Nov 3, 2011, 15:56 UTC
- Message-ID
- <4EB2B9A7.5090909@gmail.com>
- In-Reply-To
- <j8to8h$vqd$1@dough.gmane.org>
On 11/3/2011 4:50 AM, Sebastian Schuberth wrote:
Show 10 quoted lines
> 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? > > 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 >
If you are using linux, here is git diff command I use to find leftover debug statements. I imagine the -S option will work the same in git log. I pipe the results into grep to filter the results to show only the additions. (I'm using git 1.7.1)
$ git diff --unified=0 -S"DEBUG" <commit> <commit> -- <path> | grep -e "diff --" -e "+" | grep -v -e "@@" -e "+++"
maybe you will find this helpful.
v/r, neal