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!!!
Written by Ilya Dmitrichenko
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Grep
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#