Answer the question
In order to leave comments, you need to log in
How to ignore all files in git, except for a few located in different child directories?
Given: a folder with child folders, only a few hundred thousand files, the vast majority of which will definitely not change; at the root of this folder, a new git repository is raised, while empty; in the future, changes will be in several (completely different) folders, and these changes need to be tracked. There is no desire to add a huge bunch of static files, you only need to track what you need.
Task: what to write in .gitignore so as not to store the whole bunch of files, but to work with only a few of them?
Ideally, the solution should look something like this:
/*
!/first/change/for/tracking/file01.txt
!/second/small/change/file02.txt
# и так далее
/*
!/first
/first/*
!/first/change
/first/change/*
!/first/change/for
/first/change/for/*
!/first/change/for/tracking
/first/change/for/tracking/*
!/first/change/for/tracking/file01.txt
Answer the question
In order to leave comments, you need to log in
raised a new git repository, empty for now; in the future, changes will be in several (completely different) folders, and these changes need to be tracked. There is no desire to add a huge bunch of static files, you only need to track what you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question