AnneTheAgile
AnneTheAgile

Reputation: 10260

Can plain Git search / grep within a Path?

Is there a way, similar to Github's abilities, so search for code in Git history subsetted to within certain folders? https://help.github.com/articles/searching-code

Another SO question discussed how to search in general, How to grep (search) committed code in the git history?

thank you!

Upvotes: 1

Views: 53

Answers (1)

Zombo
Zombo

Reputation: 1

This should do it

git log -p -S <string> -- <path>
-p                 Generate patch (see section on generating patches).

-S <string>        Look for differences that introduce or remove an instance of
                   <string>. Note that this is different than the string simply
                   appearing in diff output.

git log

Upvotes: 1

Related Questions