Delete commit history when uncommitting
I had to undo multiple commits by executing git reset --hard HEAD^^^^
.
After git log --all
undoing commits when I run it shows all the commits I made from the beginning. (It doesn't show all deleted commits on startup git log
though) Can I confirm that executing git reset --hard HEAD^^^^
doesn't delete the commit history? Is there any parameter I can add so that commit histories are deleted as well?
source to share
There is no such thing as "remove commit" in Git. Entries are reachable if they are owned by the branch or otherwise unreachable. git reset --hard HEAD^^^^
moving the current branch 4 completes backwards, hence the 4 commands no longer refer to the current branch. But they can be referenced by other branches (usually the remote-tracking branch if you've already pushed your commits), so you see them in git log --all
.
source to share