T
T
topuserman2020-09-15 10:21:41
git
topuserman, 2020-09-15 10:21:41

Gitignore how to exclude everything except folder and file with may?

I currently have this in gitignore:

/tests/*
!/tests/admin


those. we exclude everything from the tests folder, except for the admin folder, everything works.

Now I needed to additionally exclude some files from the index prohibition by mask.

/tests/*
!/tests/admin
!/tests/services/serv_*


those. all files that start with serv_ from the /tests/services/ directory should also be indexed.

But it doesn't work. I write git status, the result does not change.

how to do it right? Or maybe something additionally needs to be done in the git? clear any cache?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
toxa82, 2020-09-15
@toxa82

You need to add the parent folder to the exclusions too
!/tests/services

L
Lynn "Coffee Man", 2020-09-15
@Lynn

Like so

/tests/*
!/tests/admin
!/tests/services
/tests/services/*
!/tests/services/serv_*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question