I want to look only distinct file which have a certain word in their text.
current_directory$ git grep 'word'
shows each line of the file which has matching word
So I tried this
current_directory$ git grep 'word' -- files-with-matches current_directory$ git grep 'word' -- name-only
But it doesn't show any output.
Also, can someone tell how can I count the total occurrences of 'word' in all files.
Any help would be grateful :)
It’s --files-with-matches. No space after the --.
Ryan current_directory$ git grep 'word' --files-with-matches fatal: bad flag '--files-with-matches' used after filename
Oh, you also have to put options before non-options. git grep --files-with-matches 'word'
Thanks :) Ryan