Silver Searcher - How to ignore a file

Jacob Wang picture Jacob Wang · Apr 10, 2014 · Viewed 15.3k times · Source

According to the docs, it should be

--ignore PATTERN

I have a file containing tags, named "tags". I have tried the following, each of them still searches through the tag file..

ag -Qt --ignore ".*tags" "asdf"

ag -Qt --ignore .*tags "asdf"

ag -Qt --ignore "tags" "asdf"

ag -Qt --ignore tags "asdf"

ag -Qt --ignore *tags

and none of them works.

If I use what's suggested here, then ag doesn't accept it at all

I tried to work around it by renaming it to temp.tags and using *.tags pattern to try and ignore it, but it still doesn't work.

Any ideas?

Answer

Mukesh Soni picture Mukesh Soni · Apr 20, 2015

Put the list of files to exclude in .agignore.

Note: as @DenilsonSáMaia mentioned, .agignore will be deprecated in favor of .ignore geoff.greer.fm/2016/09/26/ignore