I have a project directory with multiple subdirectories that contain various files with distinct file extensions. Let's say I only want to track Python source files (*.py) and C++ source files (*.cpp).
I tried this:
# ignore all files ...
*.*
# ... except these
!.gitignore # .gitignore file
!*.py # python source files
!*.cpp # c++ source files
This keeps track of the correct files that are already in the repository; however, the problem is that VSCode won't automatically track new files that I add to the project, even if they are *.py or *.cpp files.