“git checkout is one of the many reasons why newcomers find git confusing.”
One command switched branches, detached HEAD and silently threw away your local edits. Which one you got depended on whether the argument happened to be a file name. Git finally split it into switch and restore. Both are still marked experimental. The fix for years of lost work ships with a warning label.