How to use ignore file from a child directory #1977
-
Hi! I am trying to write an alias to quickly search for a string in all projects. What i'm noticing is that things like dependency folders (like Basically, I'd like to run ripgrep from directory A, but respect the gitignore files for each project In this example, assume that the git ignore in P1 has the normal npm ignore globs and P2 has the normal Elixir ignore globs. I would want to be able to run ripgrep in directory A, but for it to ignore the node_modules files and the deps files
Is this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Yes. It should work. Consider this directory tree:
With the contents of
Let's run
But wait, why are the
And now,
So if this isn't working for you, then I think you'll need to give me something that I can reproduce. |
Beta Was this translation helpful? Give feedback.
Yes. It should work. Consider this directory tree:
With the contents of
.gitignore
:Let's run
rg --files
to show what will be searched:But wait, why are the
node_modules
anddeps
files showing up? That's because neitherp1
norp2
are actually git repos. ripgrep only respects gitignore files inside git repos, and ripgrep detects git repos by the presence or absence of.git
. So let's create that: