Search code examples
linuxbashackag

Silver Searcher: how to unignore files in the .gitignore?


I have a folder of aliases. These are bash files. Some are sensitive, so I keep them in a .gitignore.

~/.bash_utilities
   bash_a.sh
   bash_b.sh
   .gitignore

.gitignore: bash_b.sh

The problem is that my Silver Searcher looks at the .gitignore and skips those files when looking. How do I tell Silver Searcher to ignore the .gitignore file and look in all the files in the directory?

My current command is

ag $1 ~/.bash*

Solution

  • IIUC, it's well explained in man ag:

    -u --unrestricted

    Search all files. This ignores .ignore, .gitignore, etc. It searches binary and hidden files as well.

    -U --skip-vcs-ignores

    Ignore VCS ignore files (.gitignore, .hgignore), but still use .ignore.