Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>The issue with this example is that `git reset HEAD~` doesn't undo anything, and it doesn't undo _any_ commit, just the last one.

I shortened the question in my comment for brevity. The full question I cited on StackOverflow was worded as: "How do I undo the most recent local commits in Git?"

> It will also cause push and merge conflicts if the commit you're "undoing" was public,

Yes, and StackOverflow answers also warned of that scenario. Again, the full SO question did ask about "_local_ commits".

>It's also not anymore cryptic than any other industry's jargon.

In my comment, "cryptic" doesn't mean the syntax doesn't have its own internal logic that makes sense once one "groks it". It's just non-intuitive for someone who has a goal in their head but the only know plain English for describing that goal.



I know what the SO question said, but this hilights the problem with natural language: it isn't an unreasonable answer to "how do i undo a commit" and is infact a top result for that very search string in ddg and Google for me.

> Yes, and StackOverflow answers also warned of that scenario.

So the answer isn't git reset, but git reset + a whole lot more natural language, even for the more narrow question asked.

> In my comment, "cryptic" doesn't mean the syntax doesn't have its own internal logic that makes sense once one "groks it". It's just non-intuitive for someone who has a goal in their head but the only know plain English for describing that goal.

Isn't the true of anything? Everything has their own jargon to express precisely what they mean. Would you tell machinist they're being cryptic if they told you to make a bolt-hole pattern? Is an accountant cryptic if they talk about something being a liability and not an asset? A ham if they ask for fsk31 and to call them on 6m? Complex things require precise language to talk about precisely. That isn't being cryptic, it's a feature of natural language that it becomes more ridgid and precise with a specialized vocabulary when things require it.


>So the answer isn't git reset, but git reset + a whole lot more natural language, even for the more narrow question asked.

Yes, and like you confirmed, all of that was in the SO answers. I'm not exactly sure what you're debating here. I deliberately put an abbreviated SO question (some words elided) in my parent comment. I also put an abbreviated answer (some words elided). I cited the full SO answers that explained all the caveats, qualifications, in a footnote. Are you complaining that I didn't copy & paste the entire ~5000 words of StackOverflow answers into my comment instead of just typing "git reset"?

>Isn't the true of anything?

Yes! And that truism is why StackOverflow is so useful.

I think the root issue is that you think I'm making a claim I didn't actually make. I never claimed that natural language English is good enough for precise programming or that it didn't have ambiguities. I also think you misunderstood my blurb about git as if I was making an all-encompassing definitive answer for "git undo" instead of using it as a lead-in to a larger point about the tool discussed in this thread.

To hopefully convince you I know what you're talking about, we can also say that non-English programming languages themselves are also fuzzy and imprecise when trying to translate to another programming language. There's always a hidden underlying semantic layer that's not visible in the surface-level text of the code. E.g. converting Javascript to C++.

  Javascript:  var x = y + z;
But numbers in Javascript are always 64bit doubles. But we don't know if the programmer truly used them as doubles or whether all the runtime values were actually 32bit integers. That hidden semantic layer requires more analysis.

Therefore we don't know if the correct translation to C/C++ is:

  int x = y + z;
... or ...

  double x = y + z;
So even trying to perfectly translate non-English programminglanguage_A to non-English programminglanguage_B runs into The Halting Problem.

Here's the key, even though programming language conversion is imperfect, the programmers still have a real-world need to translate them and that's why Google and StackOverflow are useful for attempting to convert Javascript to C++.[1] Again to emphasize: Not perfect, but useful.

You seem to be working bottom-up from some Platonic ideal of perfect precision. My parent comment was working backward from the existence of thousands of real-world questions on StackOverflow that translates natural (sometimes fuzzy) English to non-obvious answers about syntax. It's about why do those Git questions exist and why were they useful. The tool that this thread is about takes advantage of that phenomenon.

[1] https://www.google.com/search?q=C%2B%2B+for+javascript+progr...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: