Bob M
Bob M

Reputation: 411

Is it save to remove old (huge) .git/objects/$folder/$file from loacal laravel application?

Whenever I create a zip package of my laravel application it stalls for perhaps 10 seconds on a particular file in the .git/objects/1c folder

-r--r--r-- 1 root root       267 Sep  3 03:51 2594ce9a9da03d6809e24073d6d108825d5742
-r--r--r-- 1 root root 666746290 Sep 15 17:11 3132aadcdf726d34029ea4cfebd0c4be1da404
-r--r--r-- 1 root root      2394 Nov 17 09:36 3b6e5ba61c50d8c98efa06f0e81d9092510aac

This = diskspace quite a bit. I would like to know if it will cause any issues with the application or issues when I do a git push if I delete that file?

Upvotes: 0

Views: 52

Answers (2)

Bob M
Bob M

Reputation: 411

I can't talk to how others manage this stuff but in this particular case the file did not appear to be adding any value while taking a ton of disk space. I went through git log beginning at the beginning of my education and we found that I/we had done about 260 commits. Because much/most of the early stuff was just experiments there was really no need to maintain the history.

We ran a couple experiments.

  1. Under the professor's guidance (my mentor) we did a clone and created a demo. This worked perfectly and I checked for any large files and there were none - no 666746290 byte size file. The demo was happy.

  2. Not 100% satisfied I created a .zip file minus the big file.

zip -r --symlinks backups/application.zip vision -x application/storage/app/public* -x application/.env -x application/public/storage -x $fat_file

I ftp the .zip file and database file to another domain and set it up. This worked fine without any hitches.

Normally I concur with whatever folks on the forum say, however sometimes the situation warrants a little interpretation and providing you are comfortable with both filesystem and database backup files, why not experiment.

Either way, thanks.

Upvotes: 0

acran
acran

Reputation: 9063

No, it's not safe!

Although it won't affect your Laravel app it will most certainly screw your git repository, since .git/objects/ is where git stores all its contents. If the contents of .git/objects/ becomes too large you may want to try git gc to garbage collect old files and compress the rest instead.


Also if you want to package your files you might want to use git archive instead - unless you want to also package files which are normally ignored by git. Then keep using zip but maybe exclude the .git/ directory which should not be necessary for your application but contains your whole git history.

Upvotes: 1

Related Questions