I can lose something for you in 2 seconds in git. Have fun e.g. recovering from this:
$ git init
$ mkdir -p widget && echo Introduction > widget/readme.txt
$ git add widget
$ git commit -m "Initial commit"
$ echo Conclusion > widget/readme.txt
$ git checkout widget
$ cat widget/readme.txt # No "Conclusion"??See
https://github.com/git/git/blob/pu/Documentation/git-switch....
https://github.com/git/git/blob/pu/Documentation/git-restore...
git checkout [<tree-ish>] [--] <pathspec>...
Overwrite paths in the working tree by replacing with the contents
in the index or in the <tree-ish> (most often a commit). When a
<tree-ish> is given, the paths that match the <pathspec> are
updated both in the index and in the working tree.
As 'widget' is a path (and not a branchname as most often), local changes will be overwritten. Together with `git reset --hard` this is a bit a dangerous operation. I must say, that I don't fully understand the help text and just remember that `git checkout <path>` throws away my local uncommitted changes.Why would you sudo rm -rf / and not expect to destroy your system? Why is --preserve-root the default when that's clearly not what the command means? Like, that -rf wipes everything recursively is one of the first things you learn with rm...
Also see https://news.ycombinator.com/item?id=19907882
(P.S. also note the question wasn't even about whether this is expected behavior, it was just about whether it's possible to lose information when using git.)
Come now, that's being a bit hysterical/hyperbolic. There's plenty of other things you could do in the course of your command-line activities that are at least as destructive.
I know your example is meant to be trivial but there are plenty of ways when you're mucking about with pipes to ruin your day.
Like I say, "it is known" that git checkout is destructive, and while I can sympathise that perhaps the "-rf" is implicit I honestly can't see how you'd end up doing something like that in day-to-day activities, and if you did ... well if you'd spent any significant amount of time on it it probably should have been checked in anyway.
EDIT if you want to see some "good" examples of how you can inadvertently trash everything take a look at https://svnvsgit.com/ (warning, not as impartial as the title might suggest).
"victime-blaming", "shoot in the face" .. I feel are fairly extreme terms to describe what's happening here. The scenario you've concocted is really only one that could occur where you didn't know what you were doing and Git (or the command line) aren't really things you'd end up using if you didn't know what you're doing.
Way to suggest only incompetent people lose data like this.
But yes, GUIs do prevent this to a decent extent. Unfortunately git is not a tool for which switching to a GUI before you're comfortable with the CLI is a good idea. SVN is, but not git. I say this from personal experience as a TortoiseGit user. You really gotta learn the command-line first.
You just demonstrated losing something that was not in git... All you've demonstrated is that neglecting to put something into git is a good way of losing it.