Konstantin Khomoutov <kos...@bswap.ru> writes:

>> I am trying to figure a way to find the newly added *strings* in the
>> commit diff,.
>> 
>> If I do a "git diff" I get all the changes which included newly added
>> strings, modified strings as-well made in the commit, I only want the
>> newly added strings(not files) in that commit,is there a way this can
>> be achieved?
>
> I doubt it's possible simply because the very question - which strings
> are new as opposed to changed - is unanswerable in general; at least
> not without specifying a very narrow (and, I think, quite arbitrary)
> set of restrictions to do such classification.

There is the git pickaxe, i.e.,

  git log -S FOOBAR

shows only those commits where the number of FOOBAR occurrences changed.
That will include additions of FOOBAR, where the first found commit will
probably be the initial introduction of FOOBAR.

--8<---------------cut here---------------start------------->8---
       -S<string>
           Look for differences that change the number of occurrences of the
           specified string (i.e. addition/deletion) in a file. Intended for
           the scripter’s use.

           It is useful when you’re looking for an exact block of code (like a
           struct), and want to know the history of that block since it first
           came into being: use the feature iteratively to feed the
           interesting block in the preimage back into -S, and keep going
           until you get the very first version of the block.

           Binary files are searched as well.
--8<---------------cut here---------------end--------------->8---

HTH,
Tassilo

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/875yw6f02h.fsf%40gnu.org.

Reply via email to