You could:
- git clone <your github repo>
- git reset --hard <an_older_commit> (where you didn't have those huge files)
- git push --force origin master
That way:
- Your initial local repo isn't affected (and you can fix it in order to not push again those files)
- your remote (GitHub) repo doesn't see anymore those commits with the huge files in it.
- GitHub will run a
git gc
on its side periodically, cleaning completely the unreferenced files.
However the OP Martin mentions:
how can I do reset --hard
to the position before the first commit ever?
i.e. I would like to get the repo empty not to rollback to a previous commit
In that case, create a new local repo, make a first small commit, and push --force
that commit.
More generally, I always try to have a first small initial commit on master branch when creating a repo, in order to be able to get back to a minimal commit, or to start a new branch (for an unrelated development effort) from said minimal commit.