Skip to content

Exclude a directory but include specific directory nested inside #16531

Answered by MichaReiser
Tom-Boscher asked this question in Q&A

You must be logged in to vote

Yes, the gitignore takes precedence before any ruff level filtering.

I'm now not sure I understand your issue. I understand that you want to include foo/bar/baz/specific_file.py and dir1/dir2/qux and exclude foo/bar/baz/* and dir1/dir2/* which is what you have in your .gitignore... Actually, your gitignore might be incorrect if that's what you want. I think the negative excludes need to come last or git will reincluded (re-ignore) the files because they match patterns later in the file

foo/bar/baz/*
dir1/dir2/*

!foo/bar/baz/specific_file.py
!dir1/dir2/qux

Replies: 1 comment 4 replies

You must be logged in to vote
4 replies
@Tom-Boscher

@Tom-Boscher

@MichaReiser

Answer selected by Tom-Boscher
@Tom-Boscher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants