I have a very large Git repository which only contains binary files which are changed pretty often. Naturally the Git repository is much larger than the actual
Ok, if you want what I think you want (see my comment), I think this should work:
Create branch to save all the commits (and just in case):
git branch fullhistory
While still on master, reset --hard to the commit you want to retain history from:
git reset --hard HEAD~5
Now reset without --hard
to the beginning of history, this should leave your workspace untouched, so it remains in HEAD~5 state.
git reset --soft
So now you have empty history on master
, and all the changes you need in the workspace. Just commit them.
git commit -m "all the old changes squashed"
Now cherry-pick this 4 commits from fullhistory
you want to have here:
git cherry-pick A..B
Where A is older than B, and remember A is NOT included. So it should be parent of the oldest commit you want to include.