On my Git branch, I created a commit and pushed. later, I added changes to the index, used git commit --amend
, and then git push -f
. My new commit overrode the first one both locally and remotely on my branch.
At this point, I'd expect (or want) the original commit to no longer exist, or at least exist (perhaps in the reflog) but no longer have a parent, so, once I run GC, it'll cease to exist. However, it seems like the commit is still there, and its parent is still intact. (In this case, the way I found out about it was via Jira, which linked me to my overridden commits on github)
Why is that so? How will it get deleted? Does this mean that, whenever I accidentally push a password to GitHub, and then use git commit --amend
or git reset
, and then git push -f
, the commits never actually truly get deleted?