How can I find the bare Git repository for a string in the contents of the current version?

Is it possible that Git searches for the contents of text files in the bare repository for a specific string?

I am creating a WebGit.NET search function to allow the search for the current state of all repositories for text.

+4
source share
3 answers

Something like that?

git grep -e textstring HEAD 

or

 git ls-files|xargs -I% -n 1 git cat-file -p HEAD:%|grep textstring 
+4
source

It looks like you are looking for git grep . When searching in an open repository, you must specify where to look:

 git grep foobar HEAD 
+5
source

Use pick ax to see where text has been added or removed in the story.

 git log --all -S'your text' 
0
source

Source: https://habr.com/ru/post/1380253/


All Articles