Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable specific ignore files (specifically $HOME/.gitignore) #2447

Closed
munro opened this issue Mar 9, 2023 · 2 comments
Closed

Disable specific ignore files (specifically $HOME/.gitignore) #2447

munro opened this issue Mar 9, 2023 · 2 comments
Labels
wontfix A feature or bug that is unlikely to be implemented or fixed.

Comments

@munro
Copy link

munro commented Mar 9, 2023

Hello!

I manage my ~/ directory dotfiles with git. And thus, I have a special ~/.gitignore that excludes everything but dotfiles [1].

Sooooo what happens is when I use rg, it never finds anything unless I add --no-ignore-vcs. Problem with that is I still want it to use every other .gitignore — because it's really helpful!

I also tried --no-ignore-parent, which seems to work well, except it doesn't work at all when I'm in ~/ which is annoying.

It would be really nice to have something like rg --no-ignore-exclude=~/.gitignore

[1] https://github.com/munro/dotfiles

# ignore everything
*
# except dotfiles!!!!!
!.*
!.oh-my-zsh


# don't commit these dot files to the repo
.DS_Store
.Xauthority
.bash_history
.brew_packages
.cargo/
# ...
@BurntSushi
Copy link
Owner

Your specific feature request is definitely never going to happen. There are already a bazillion flags for ignoring various flavors of ignore files, and I'm sorry, but there is just no way I could justify adding more flags to override individual ignore files. Both the user facing and internal complexity of that is mind boggling to me.

However, thank you for sharing the actual problem you have. Because there are solutions to it.

The first it to add a .ignore file right next to your .gitignore that whitelists everything, and then blacklists whatever you don't want to search. For example, echo '!*' > ~/.ignore.

Second is the approach I use now. I used to do the first approach of, but other than it being annoying for ripgrep, I actually didn't like it because it was annoying to add new files since git ignored everything by default. It happened too often that I'd add something, forget about it, later run git status and see that there were no changes. And only then realize that I had never actually committed the new thing I added. So now I maintain an exhaustive list of ignored files in my home directory.

@BurntSushi BurntSushi closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2023
@BurntSushi BurntSushi added the wontfix A feature or bug that is unlikely to be implemented or fixed. label Mar 9, 2023
@munro
Copy link
Author

munro commented Mar 10, 2023

@BurntSushi yesss thank you echo '!*' > ~/.ignore worked perfectly! it wasn't totally obvious how I could exclude that file, thank you!

love-you-brown-bear-1 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix A feature or bug that is unlikely to be implemented or fixed.
Projects
None yet
Development

No branches or pull requests

2 participants