nptq3w
Last Updated: February 25, 2016
·
493
· errordeveloper
121dcfb4f05ed316247772545e2cd590

Context-aware grep

Have you ever wondered how to do context-aware grep in your code?

git-grep(1): -p, --show-function

        Show the preceding line that contains the function name of the match, unless the matching line is a function name itself. The name is determined in the same way as git diff works out patch hunk headers (see Defining a custom hunk-header in gitattributes(5)).

Just try it! You can even define your own hunk-header!!!

Say Thanks
Respond
Filed Under