News for hackers. Stuff that matters.
Re:Idiot Proof Git by throwaw20221107 on Wednesday November 09, 2022 @05:47PM (#33539201)
The only reason people lose code is because

1. they didn't read this one diagram: https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-...

2. And then they run `reset --hard`

Re:Idiot Proof Git by veilrap on Friday November 11, 2022 @12:38AM (#33557649)
I'm mostly with you, except, `git reset --hard` is relatively easy to recover from. `git reflog` generally can fix most `git reset --hard` commands.

On the other hand. `git checkout .` with unstaged changes tends to be the most common way I've seen people lose code via git.

Re:Idiot Proof Git by throwaw20221107 on Wednesday November 16, 2022 @01:52AM (#33619783)
That's fair. Both overwrite (edit: seemingly overwrite) (un)staged changes. But `checkout` requires less hyphens.

I feel like all of this would be resolved if my boy Linus had renamed `git add` to `git stage` or `git prepare` or something more clear.

Or added some warning, like "all this stuff you haven't committed yet; it's not managed by `git` so don't try to overwrite it all using `git` until you've committed some of it."

Re:Idiot Proof Git by throwaw20221107 on Wednesday November 16, 2022 @01:57AM (#33619817)
This is another argument why "not squashing is bad"; because it discourages people from committing.