tags:

views:

577

answers:

2

Is there a command that would allow me to check if the string "xyz" was ever in file foo.c in the repository and print which revisions they were found in?

+5  A: 

This will print any commits where the diff contains xyz

git log -Sxyz foo.c

CaptainPicard
A: 

I know you can do this with gitk, you can search for commits "adding/removing string" and give it some text to look for. There's a way to do this from the command line too, but I don't recall off the top of my head.

Greg Hewgill