In a git repository, is there any difference/benefit using git grep
over good old grep
?
An example would be?
git grep
only searches in the tracked files in the repo.
With grep
you have to pass the list of files to search through and you would have filter out any untracked files yourself.
So if you are searching for something that you know is in the repo, git grep
saves you time as all you have to do is provide the pattern. It also is useful for not having to search through anything that is untracked in the repo.