How do I completely remove a commit from GitHub?
On GitHub, I forked the repository and cloned it on my PC. Then, for testing purposes, I edited the file, made a commit, and pushed it to GitHub. But now I would like to completely remove this commit.
I did the following:
git reset --hard <sha1_of_previous_commit>
git push --force
It looked fine, but my commit was still available on GitHub at the URL with the SHA1 of my commit. So I deleted the repository on GitHub, then the url said "Not Found".
But if I create the same repository again, my commit is available again at that url. Please help me how the hell can I get rid of this commit?
source to share
" Removing sensitive data from the repository " is quite clear:
It's important to note that these commits can be accessed from any clones or forks of your repository, directly through their SHA-1 hashes in cached views on GitHub, and through any pull requests that reference them.
You can't do anything with existing clones or forks of your repository, but you can permanently delete all cached views of your repository and pull requests to GitHub by contacting GitHub support.
In your case, there was (hopefully) no fork / clone, but you need to contact GitHub support to request gc on their version of the repo so that the commit is no longer available via its SHA1 URL.
source to share