It seems that my initial commit is eating up 90% of the space, since it accidentally got made with quite a lot of media files in it. Is there a way to remove just the first commit from local and remote repos, or should I just leave this one be?
Share
It sounds like you’ve already shared the repository with a number of other users. If this is the case, then you should probably just live with it.
If you’re in control of all of the clones then you can re-write the history on top of a modified root commit with the unintended files removed. Note that you shouldn’t do this if other developers have already based work off this branch.
If you’re into rewriting history then you can try the following. Note that because git keeps around logs of where your HEAD commit has been recently (reflogs), the large objects won’t immediately disappear from your repository, or other repositories which already have them, even if you attempt to
git gcorgit gc --prune. It will, however, ensure that any new clones won’t end up fetching the large objects as part of the history of the master branch.Assuming that your working directory is ‘clean’: