5

How can I delete a commit on a git remote hosted by github.com? I already found multiple answers on SO that show how to remove a commit from the commit history of a branch. I attempted these, however my commit is still clearly available because I can browser directly to it using its hash.

So for clarity, my question is not how to remove a commit from the commit history of all my branches on my remote. My question is how to remove the commit itself, so that there is no record of it on the git remote that I previously pushed my branch to.

Solutions I've tried include:

Remove last commit from remote git repository

Rolling back local and remote git repository by 1 commit

EDIT: Git: permanently remove few commits from remote branch is another solution that didn't work for me. The reason this particular solution did not work is because it stays to "git push --force your revised local branch to the remote.", which doesn't delete commits from the remote and instead only removes them from the commit history of the current branch.

Community
  • 1
  • 1
Trindaz
  • 17,029
  • 21
  • 82
  • 111
  • after removing locally, push your changes to the remote and check again – obataku Jul 30 '16 at 23:01
  • 1
    There seem to be a lot of search results, both on SO and on the interwebs. Have you tried http://stackoverflow.com/questions/3293531/git-permanently-remove-few-commits-from-remote-branch? – aceofbassgreg Jul 30 '16 at 23:03

1 Answers1

7

Quote from "GitHub support" [1]:

Github runs gc on a periodic basis. If you want have the files removed from the repo immediately, you'll have to delete and recreate the repo.

Haozhun
  • 6,331
  • 3
  • 29
  • 50