News for hackers. Stuff that matters.
Re:Things I wish everyone knew about Git (Part I) by lisper on Wednesday June 29, 2022 @08:37PM (#31927459)
> The entire point of that command is to discard local changes.

I think that's arguable, but it's neither here nor there. Someone who is not well versed in git arcana will be surprised that the level of risk associated with 'git checkout [branch]' is radically different from 'git checkout [directory]'. I think a lot of people will learn this the hard way, especially if they have been told "It is very hard to permanently lose work." It's not true. Permanently losing work is as easy as being careless with git checkout.

Re:Things I wish everyone knew about Git (Part I) by nemetroid on Thursday June 30, 2022 @04:02AM (#31929847)
> Someone who is not well versed in git arcana will be surprised that the level of risk associated with 'git checkout [branch]' is radically different from 'git checkout [directory]'.

I disagree that it's a difference in the level of risk. There's no "risk" that git checkout [path] will discard your uncommitted changes, it's a promise and a certainty.

That said, I agree that the breadth of largely unrelated functionality smushed into git checkout is surprising, but it's also one of the few things about Git's user interface that actually has been addressed by new subcommands.

Re:Things I wish everyone knew about Git (Part I) by wizofaus on Wednesday June 29, 2022 @10:34PM (#31928200)
I haven't learned the hard way thankfully, but I certainly found it very surprising. It's not at all obvious, and the GUIs with git support call it something like "Undo changes" or "Revert" etc.