News for hackers. Stuff that matters.
Re:Git undo: We can do better by stormbrew on Monday June 21, 2021 @06:34PM (#27585419)
changing `-f/--force` to act like `--force-with-lease` would have no effect on that flow whatsoever. What it would prevent is you accidentally overwriting something on the remote because you didn't know its current state, potentially silently backing out changes someone else (or perhaps you yourself on another machine) had pushed.

All it does is add this simple check before actually pushing:

    if (remote_ref("blah") != local_ref("remote/blah"))
        fail();
Most of the time it doesn't matter, and for most people's uses of --force it would have no effect (because most people are just pushing to a branch they're the only one pushing to). But every now and then it helps a lot to avoid losing data.
Re:Git undo: We can do better by saagarjha on Wednesday June 23, 2021 @05:03PM (#27610338)
It’s important to also understand where this might fall down: many tools fetch automatically and this can cause issues with reliability here.