Remove commit permanently
I know there are thousands of topics for this question.
But I learned something really strange.
If you are building a project on GitHub do some commits.
Let them say, do 1, 2, 3, 4, 5.
Later you realize you want to change something in commit 3.
Since you were working on your own branch, there is no problem rewriting history.
So let's do the following: (based on this stackoverflow answer)
git rebase --interactive 'bbc643cd^'
// Modify 'pick' to 'edit' into interactive prompt and :
git commit --all --amend --no-edit
git rebase --continue
git push -f
Fine! The bug has been fixed. History has been rewritten, so commit is bbc643cd
now lkqjfhchc
.
You can check the source on your GitHub and everything will be updated.
But someone can still find it on GitHub!
URL access: https://github.com/your-nickname/your-project/commit/bbc643cd ... (full hash) and you will find it!
How can we remove this commit permanently?
Thanks for any help!
I contacted the Github staff from here: https://github.com/contact
Here's the answer (I couldn't do anything about it, no prunes, no gc, etc.)
Hey Maxim,
The end was available because commits are not automatically removed when they are removed from the branch history - they are removed when they are garbage collected. I just ran the garbage collection for this repository manually and the commit should now return 404.
Hope it helps.
Cheers, XXXXX
So, you just have to wait or contact the staff to force the garbage collector if you have the same problem!
As per your additional comments:
You have done everything as it should be.
The point is, git never loses data unless you report it (what's known as gc
a garbadge collector)
The files will stay there until they are called by gc.
It is called dangling file
Dangling commit
An end that is not associated with any branch or tag, nor with a direct one, nor with any of its descendants.
You can see all the wrapped links locally with this:
git fsck --full
The only way to get rid of it is to run gc
//
// !!!Caution:
// It will remove all your dangling files
git gc --aggressive --prune now
Here you can read more about this.