Rails application folder large due to GIT pack file

So, I noticed that my Heroku cork size was huge (100 mb) and decided to check my Rails design structure to see what causes the huge size.

When I examined the project folder, he said that its size is about 100 MB. However, after checking all the files and folders (first level), I did not see a single criminal (my logs are deleted daily).

I tried deleting all the contents (of course, the code on github!), But when I check the folder, it still says that its 99.9mb on disk is strange.

I sudo'd to a folder in the terminal and ran ls -al to see if there are any hidden files or folders, but got only the following:

-rw-r--r-- 1 <name> staff 15364 15 Apr 16:03 .DS_Store drwxr-xr-x 3 <name> staff 102 17 Apr 2012 .bundle drwxr-xr-x 18 <name> staff 612 15 Apr 15:18 .git -rw-r--r-- 1 <name> staff 487 4 Apr 10:21 .gitignore 

I don’t think anything unusual.

Has anyone seen a similar situation and can advise a solution?

UPDATE

So, it seems that the .pack files in the .git folder are the problem here. I searched and ran a little

 git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch unwanted_folder' --prune-empty 

and

 git gc --aggressive --prune 

Which deleted everything except one of the package files. What scares me is that the remaining batch file is 75 MB when all the code and assets reach 25 MB? I assume that he kept a history of changes made locally since the repo was initialized or something else? If so, how can I clean them? I save all changes to github anyway, so the old files / versions are redundant (unless I am missing something?).

+4
source share

All Articles