Charts · 22
Your commit is not gone
git reset --hard rewrote one 40-byte file and your afternoon appeared to vanish. It did not: the commits are sitting in the object database with nothing pointing at them, which is a different thing from deleted. Step through nine commands and watch the graph. Commits are immutable objects, branches are names that point at one, and the shape of the graph is the only real difference between a merge and a rebase.
Three commits on main. A commit is an immutable object: a snapshot, its parents, and a hash of all of it. main is a file containing one commit id. HEAD is a file containing the word main.
git reflog
c3d4e5f HEAD@{0}: commit: Fix the empty state