Skip to content

How do I include hidden directories but exclude .git folders? #1578

Answered by okdana
haji-ali asked this question in General
Discussion options

You must be logged in to vote

The glob patterns are meant to work like the ones in .gitignore; you can just use !.git (or !.git/ to be more precise)

% git init
Initialized empty Git repository in /home/dana/test/.git/
% \rg --no-ignore -q --hidden refs && echo match || echo no match
match
% \rg --no-ignore -q --hidden -g '!.git/' refs && echo match || echo no match
no match

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@BurntSushi
Comment options

Comment options

You must be logged in to vote
6 replies
@BurntSushi
Comment options

@3052

This comment was marked as off-topic.

@BurntSushi

This comment was marked as off-topic.

@BurntSushi

This comment was marked as off-topic.

@3052

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants