I have some orphaned commits accidentally committed to GitHub.
I use git reflog expire --expire-unreachable=now --all
to remove them from git rev-list --all
. (I tried use git gc --prune=now --aggressive
but maybe the repo is too big, it crashes and make all windows closed. I use Arch Linux and Kde6. Maybe My 16GB memory is a bit small.)
Then I tried git gc --prune=now
. After that, git show foo_orphan_commit
will show “fatal: ambiguous argument ‘foo_orphan_commit’: unknown revision or path not in the working tree.”. It seems that the commit has been removed from the local repo.
But in Github, when the commit to delete has message “#1”, then in the Github #1 issue it still shows the message like “Someone added a commit that referenced this issue … foo_orphan_commit”.
Then is there one way to remove that commit completely from Github? I expects the commit won’t be showed in Github with the above message.
1