Is it better to use git grep than plain grep if we want to search in versioned source code?

后端 未结 5 1844
温柔的废话
温柔的废话 2021-01-31 02:03

In a git repository, is there any difference/benefit using git grep over good old grep?
An example would be?

5条回答
  •  误落风尘
    2021-01-31 02:38

    If you're searching for patterns/strings within a git repository (i.e. in files that are already tracked), then yes, git grep should be much faster typically than regular grep as it is indexed. (You can try this out manually, the git-grep should be perceptibly faster)

提交回复
热议问题