Reputation: 49565
Is it possible for Git to search the contents of the text files in a bare repository for a specific string?
I'm building a search feature for WebGit .NET to allow for searching the current state of all repositories for text.
Upvotes: 6
Views: 3978
Reputation: 129782
Use pick axe to see where in history the text was added or removed
git log --all -S'your text'
Upvotes: 1
Reputation: 994817
It sounds like you're looking for git grep
. When searching a bare repository, you must specify somewhere to search:
git grep foobar HEAD
Upvotes: 6
Reputation: 143299
Something like that?
git grep -e textstring HEAD
or
git ls-files|xargs -I% -n 1 git cat-file -p HEAD:%|grep textstring
Upvotes: 4