Skip to content

--override-ignore flag to selectively bypass .gitignore #1885

@benodiwal

Description

@benodiwal

Currently, fd respects .gitignore rules (great for most searches), but sometimes you need to find files inside gitignored directories like node_modules, build, or .cache. The only option today is --no-ignore / -I, which disables all ignore rules.

This forces users into an awkward workaround, disabling all ignores and then manually re-excluding every other pattern from .gitignore:

# Just want to search inside node_modules, but .gitignore also has
# build/, dist/, *.pyc, .env*, coverage/, .cache/, tmp/ ...
# Now you have to re-add ALL of them as --exclude:
fd -I --exclude build --exclude dist --exclude '*.pyc' \
     --exclude '.env*' --exclude coverage --exclude .cache \
     --exclude tmp pattern

This is tedious, error-prone, and breaks every time .gitignore changes.

Proposed Solution

Add --override-ignore <pattern> flag that force-includes entries matching the given glob pattern, even when they'd be excluded by .gitignore, while keeping .gitignore active for everything else.

  # Instead of the mess above, just:
  fd --override-ignore node_modules pattern

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions