What grep command will include the current function name in its output?

前端 未结 9 2177
夕颜
夕颜 2021-01-07 18:08

I run diff with the -p option so the output will include the name of the function where each change occurred. Is there an analogous option for

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-07 18:14

    Here you go:

    git grep --no-index -n -p 'return'
    

    You just need git. The files being searched do not need to be part of a git repo. But if they are, then omit --no-index and get an instant speed boost!

提交回复
热议问题