so I'm working with some friends and we are all new to git and one of them committed a large amount of external binary files that slows down the repository, and takes up a large disk-space.
We've just started the project so there's nothing important in it really except a readme file. So what we'd like to do is to Clear the repository history to the current state.
So basicly it looks this:
Head -> A -> B -> C total disk size 45 MB, 1 file, 300 deleted files
And we want this:
Head -> A total disk size 1 kB, 1 file, 0 deleted files
The obvious solution would be to create a new repository and just copy the readme file into the new repository. However I'd like to learn for educational/curiosity if there's GIT command that can do this.
I've been experimenting with the Rebase command, but it seems like it still keeps old history and their data, which confuses me since if rebaseing doesnt prune data from the repository then you might aswell not use it.
I've been googling some other posts on this issue, and im suspecting that you can't do this with git. However I'd like to confirm that.
And yes it's a remote directory on github
Thanks for any help.
So for my solution i chose to do:
rebase using tortoisegit
squash all commits
then using git bash:
git reflog expire --all --expire-unreachable=now
git gc --aggressive --prune=now
git push origin master --force
It doesn't seem like the local repository history wants to shrink in disk size. However cloning the repository again shows the desired results and disk size. And the repository log does too.
Thanks for the helpful replies. Interesting Rebase seems very powerful.