Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Throwing away old history on git repo full of binaries

Tags:

git

I've got a git repo with three years worth of PowerBuilder binary files. The repo is pretty huge (just under 10GB), I assume due to the fact that git can only do so much for binary deltas.

I'd like to get this repo to a manageable size, and I'm willing to throw away a bunch of early history to do it. I just can't figure out how to get git to do it. I tried squashing commits with interactive rebase, but it comes up with a bunch of conflicts I don't want to deal with.

Is there a way to pick a commit, and just throw away everything before that? I realize it will rewrite the SHA-1 for subsequent commits, which is no problem.

like image 918
Doug Avatar asked Nov 13 '22 10:11

Doug


1 Answers

This is one (other) way:

git fast-export master~5..master | (cd ../newrepo.git && git init . && git fast-import && git checkout)

The above example will take commits in range master~5..master and create new repo out of that. You can use the same repo too, but the above will be safer.

like image 63
manojlds Avatar answered Nov 16 '22 01:11

manojlds