I had to undo a few commits by doing git reset --hard HEAD^^^^.
After undoing the commits, when I ran git log --all, it shows all the commits I have done from the beginning. (It doesn't show all the deleted commits when I run git log though) Can I confirm that doing git reset --hard HEAD^^^^ doesn't delete the commit history? Is there any option I can add so that the commit histories are erased as well?
Have a look at git gc. Invoking git gc will remove any commit object that does not have anyone referencing it (be it a child commit, a branch or a tag).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With