I rewrote the history of a GitHub repository two weeks ago (rebase and some cherry-picks) and force pushed it back to GitHub via
git push -f origin master
Everything went fine, at least it looked that way and git log
showed the correct commit history. I know, rewriting history is bad practice, but the repository is new and I'm the only user, so there should not be any troubles for others.
My repository has only one branch, named master
.
Now to my problem. GitHub's Source view of my repository shows at least one commit that should no longer exist due to my rewriting of history. And indeed it does not exist in my local nor in GitHub's commit log (but it is part of my local reflog). How do I get rid of this commit and possibly others that are in my remote GitHub repository? Is there any way to clean up a remote repository and delete those "unreachable" commits that are not part of the commit log?
BTW if I clone the GitHub repository, the rogue commit is not present in the clone. git show <SHA1>
returns fatal: bad object
.
My question is very similar to SO 4367977 but the solution to that question "waiting for GitHub's garbage collection" did obviously not work. The commits-links still work after 6 months have passed.
Deleting the repository and recreating it should solve the problem but this it not very elegant.
Thanks in advance!