I have a project with two directories I would like to version-control. Next to these directories are temporary build files. Is there any chance to setup gitignore properly? It seems git still complains about the project size
Here is my directory:
./
+--- source1 (1000 files)
| +---headers
| +---sources
| +---temp_project_files (1000 files don't belong to git)
|
+--- source2 (1000 files)
| +---headers
| +---sources
| +---temp_project_files (1000 files don't belong to git)
|
+--- temp_build (80.000) files
|
|
+--- .gitignore
My gitignore file contains this:
!/source1/**/*.cpp
!/source1/**/*.h
!/source2/**/*.cpp
!/source2/**/*.h
So I filter out everything except for *.cpp and *.h files, still git complains by telling me:
> The git repository at /path/to/dir/ has too many active changes, only a subset of Git features will be enabled.
Reason for that is, that git seems to check in all files from gitignore as untracked. What am I doing wrong here?
Directories and files are automatically set as tracked if not dealt with in the .gitignore file. Therefore, you need to specifically add the folders you want to ignore, not the ones you do not want to ignore. You would add the ones you would not want to ignore if they're in a directory you're already ignoring. Therefore, you probably want this in your .gitignore file.
temp_build/
source1/temp_project_files/
source2/temp_project_files/
If you add a folder to .gitignore, it will automatically ignore all the files and folders inside that folder.
Also, the error you are getting is probably not related to the size of the directory, but instead, related to you making all the changes at once.
Note: If you really really want to do things the way you are, stick a * up at the top of your .gitignore, that'll ignore all files and folders by default.
Why not to ignore the entire directories, just two entries needed in .gitignore
temp_project_files/
temp_build/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With