Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directory too big for git

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?

like image 914
Daniel Stephens Avatar asked Jul 12 '26 20:07

Daniel Stephens


2 Answers

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.

like image 121
OrdoFlammae Avatar answered Jul 14 '26 13:07

OrdoFlammae


Why not to ignore the entire directories, just two entries needed in .gitignore

temp_project_files/
temp_build/
like image 26
Karol Dowbecki Avatar answered Jul 14 '26 12:07

Karol Dowbecki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!