Hacker News new | ask | show | jobs
by bluetech 2842 days ago
One reason I still use git grep is this: I have some minified .js files in the repository, which I don't want to be included in grep results. So I mark the files as binary in gitattributes, then git grep just says "Binary file foo matches".
1 comments

For ripgrep, you can achieve this via a custom ignore file, e.g., `echo '*.min.js' > .ignore`.

Another approach I've seen people take is to put `-M300` in your ripgrep config file, and then any super long lines are automatically omitted from output.

I've seen the few posts deciding to use .ignore as the file name but I hope this won't be a mistake in choosing the right name without enough discussion. Even for users it's hard to figure what the file is for.

I consider .grepignore to be more comprehensible.

You can also use .rgignore.
Have you considered parsing .gitattributes and offering support for reducing files marked as "binary" down to a "binary file matches" notice?
Nope. I don't think I've ever used .gitattributes. Might be a neat idea. Not sure.