Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to permanently delete a commit from a removed branch? [duplicate]

Tags:

git

How to permanently delete a commit from a removed branch so that it becomes unreachable?

* aa448ae (orphan) 
| * 1c0c419 (HEAD -> master) 
|/
* 0bfa9c3 

git branch -D orphan
git gc --prune=all
git filter-branch

And it's still available when I do:

git show aa44

or:

git branch test aa44
like image 365
Stachu Jemioła Avatar asked Dec 08 '25 17:12

Stachu Jemioła


1 Answers

To remove all dangling commits and those reachable from the reflogs:

git reflog expire --expire-unreachable=now --all
git gc --prune=now
like image 95
Bless Avatar answered Dec 10 '25 11:12

Bless



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!