The git log command works by starting from some particular commit or set of commits, whose IDs are eventually raw OIDs,1 and then working backwards through the commit graph.2 The OIDs come from arguments given to git log; with no OID arguments and no substitutes for them, the default is to look up HEAD as an OID. So this:
When I do a git log --pretty=oneline --abbrev-commit it returns commits with the latest at the sha I used in the reset command. This is what I’m expecting.
is fine. (Note by the way that --oneline is short for --pretty=oneline --abbrev-commit, so you might want to use this to shorten your command line sequence.)
However, I then did git log --pretty=oneline --abbrev-commit —-all and it is returning commits I thought I stripped. Why is this history still here?
The --all option pretends that all refs/ entries (all references: all branch names, tag names, and other special names that are not the HEAD or *_HEAD special names) were specified on the command line. One or more of those refs must resolve to, or lead to, the hash you thought you stripped.
It's not unusual for refs/stash to do this, for instance, or for some other branch name to do this.
You can run git for-each-ref with no arguments at all to list out all the refs that --all implies.
1It's best not to call these "SHA" now as other hash algorithms are allowed, at least in theory. It's true that the upcoming change is to use SHA2-256, which is still an SHA hash, but the internal Git term is now OID, or Object ID.
2With -g (--walk-reflogs), the walk is through the reflog rather than the commit graph. With --no-walk the walk itself is suppressed, so that you get only the initially-selected OIDs.