3 ms·
I don’t think there’s been a point to using `git grep` since ack started parsing gitignore. As far as I’m concerned the use case of `git grep` is to search into
by masklinn 3y ago
I don’t think there’s been a point to using `git grep` since ack started parsing gitignore. As far as I’m concerned the use case of `git grep` is to search into non-checked-out trees (by giving it a tree-ish). And it’s not super great at that, because it searches a static tree-ish, so pickaxe filters are generally more useful (though they’re slow).
Once again mercurial has/had more useful defaults, `hg grep` searches through the history by default, that’s it’s job.
- burntsushi 3y agoSmall clarification: ack did not and does not respect your gitignore files. I just tried it myself, and indeed it doesn't. And this is consistent with the feature chart maintained by the author of ack: https://beyondgrep.com/feature-comparison/ https://beyondgrep.com/feature-comparison/ One practical result of this is that it will mean `ack` will be quite slow when searching typical checkouts of Node.js or Rust projects, because it won't automatically ignore the `node_modules` or `target` directories. In both cases, those directories can become enormous. `ack` will ignore things like `.git` by default though. I believe `ag` was the first widely used grep-like tool that attempted to respect your .gitignore files automatically. (Besides, of course, `git grep`. But `git grep` behaves a little differently. It only searches what is tracked in the repo, and that may or may not be in sync with the rules in your gitignores.)
- ctenb 3y agoYou can also pass a flag to git grep to ignore the index (--no-index), which makes it search untracked files as well
- burntsushi 3y agoI know. That's beside the point of my comment. :-)