News for hackers. Stuff that matters.
Re:Oh Shit, Git? by rcxdude on Sunday August 16, 2020 @10:19AM (#24178026)
The reason there's so much discussion is because while the question seems simple, it's ill-posed and there are several distinct things they could actually want to be doing: do they want to make a commit which undoes another commit, do they want to check out an older version to either test something or make a branch, or do they want to remove some commits they made accidentally? All of these are reasonable things to want to do and the only reason the answer may seem easier for other systems is because for some of those options either can't do them or they are so difficult and risky you're only going to do them if you really have to. That's why the top answer gives three different options based on different possible interpretations of the question. The rest of the discussion is either people who think that some of those options shouldn't exist for mostly ideological reasons or people who haven't taken the time to understand what each of those options actually mean.

If all you want from a VCS is a snapshot of each part of history, git can do that (and will actually do it better than a more traditional option like SVN because it doesn't hide merges by doing them on your working directory before you commit), but ultimately there's a lot of value in doing more and if you want to exploit that you should understand how the VCS represents your code and how to use it, not paste together advice from other people on the internet who may not fully understand it themselves. I agree the git UI has problems, mostly relating to naming things and the fact that many commands have convenience options which mean they invoke actions which are different from their base operation (like git checkout -b <name>, which is basically a way of doing git branch <name> followed by git checkout <name>. It would make more sense if this was just the way git branch operated by default, or at least as a flag on git branch instead of git checkout). The underlying model git presents is really not hard to learn (and it helps a hell of a lot when googling how to do something because you can be precise about it) but it's where people tangle themselves most in knots because they think it's either too difficult or not worth understanding, and it's wrong on both counts because it will cost them hugely in time and stress.

Re:Oh Shit, Git? by jariel on Monday August 17, 2020 @03:46AM (#24184974)
" there are several distinct things they could actually want to be doing"

Yes - I get that - but this is my point.

It's such a complicated tool (or rather, specifics are not obvious) that people don't even know how to ask questions.

This is part of my point.

Ambiguous questions, ambiguous answers, a real propensity for people to be giving really bad answers.

This is endemic with Git, more so than I've seen with anything else.

I sometimes wonder if Git should should actually be used with some kind of visual representation as a default standard - and that our propensity for 'command line interface' as the de-facto means of real interface with computers may not be appropriate to communicating 'what is going on'.

Much like people fuss desperately over road signs, human factors in automobiles ... perhaps we should be thinking in these terms much more with this tool.

Re:Oh Shit, Git? by rcxdude on Monday August 17, 2020 @04:33AM (#24185239)
I agree on the GUI front: git is a lot more comprehensible when you have a graphic representation of the commit graph at all times. This is my default way of interacting with git: even if I'm using the CLI to mutate the repository, I have a GUI open to view the repo.