views:

1006

answers:

2

I tried looking for a good tutorial on reducing repo size, but found none. How do I reduce my repo size...it's about 10 MB, but the thing is Heroku only allows 50 MB and I'm no where near finished developing my app.

I added the usual suspects (log, vendor, doc etc) to .gitignore already. Although I only added .gitignore recently.

Any suggestions?

+8  A: 

As Lieven mentions in the comment, git gc --aggressive is one way to force the prune process to take place.
You have in this SO answer other commands to clean the repo.
And do not forget sometimes git gc alone can increase the size of the repo!

It can be also used after a filter-branch, to mark some directories to be removed from the history (with a further gain of space):
see this SO question. But that means nobody is pulling from your public repo, though.
And filter-branch can keep backup refs in .git/refs/original, so that directory can be cleaned too.

VonC
In another scenario, see also http://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-big
VonC
Got it down to less than 1MB...thanks!
Senthil
@Senthil: great! You could post as an answer the exact sequence of command you were using to get to this result ;)
VonC
+1  A: 

Thanks for your replies. Here's what I did:

git gc
git gc-aggressive
git prune

That seemed to have did the trick. I started with around 10.5MB and now its little more than 980KBs.

Senthil