grep with show-function

You can grep sources and see context function like with diff –show-c-function or diff -p.

Search sources stored in git and show the preceding line that contains the function name of the match:

git grep –show-function STR

Same, but search files not in git, even without git repository:

git grep –no-index –show-function STR

References:
git grep