It seems like git gc --aggressive
really cleans up my repo, but when I do git push
everything is already up-to-date. Is there a way to clean up the
I believe that pushing your changes will only add new commits (as necessary to reach the branches you are pushing); it will not delete them. This is corroborated by this github support page on deleting sensitive data:
Be warned that force-pushing does not erase commits on the remote repository, it simply introduces new ones and moves the branch pointer to point to them. If you are worried about users accessing the bad commits directly via SHA1, you will have to delete the repository and recreate it.
So if you can't wait for GitHub's periodic gc, then you have to recreate.