git - How to reduce disk space usage in a large repository? -


i have git repository 1 year of development history, , 37gb. how can minimize size in way delete old history? is, need history covers last 2 months, others can removed.

the 3 main options are:

on last point, see "how remove old history git repository?", using script 1 (with sha1 of commit 2 months ago, parameter)

#!/bin/bash git checkout --orphan temp $1 git commit -m "truncated history" git rebase --onto temp $1 master git branch -d temp  # following 2 commands optional - keep git repo in shape. git prune --progress # delete objects w/o references git gc --aggressive # aggressively collect garbage; may take lot of time on large repos 

since rewrites history, need git push --force.
since op pushing git.assembla.com (see discussion), this issue states

you need enable --force option.
done git repository settings tab. need 'owner' on space see settings tab.


Comments