News for hackers. Stuff that matters.
Re:Key Git Concepts Explained the Hard Way by CodeMage on Wednesday March 14, 2018 @03:04PM (#16587380)
I believe people have a hard time with Git because it's simply not user friendly. Once you've grokked a handful of essential concepts, Git becomes easy to use proficiently, but both the user interface and documentation are so user-hostile that most people never get to that point.

A few examples:

- `git reset` command can perform wildly different actions depending on its options

- `git revert` does not do what most users would hope it does

- if you actually need to revert your working tree changes, you might need to use `git checkout`

Naturally, people get confused and reach for the docs, which are filled with even more newbie-hostile terms like 'tree-ish', 'hunks' and 'refspec'.

As a result, people tend to see Git as this scary, incomprehensible hairball.

Re:Key Git Concepts Explained the Hard Way by adrianmonk on Wednesday March 14, 2018 @05:57PM (#16588679)
A lot of it is easy UX wins left on the table.

"git revert" would have been clearer if it were identical but just named "git retract". It's a more natural match because reverting usually just means going back to how things were, whereas retracting can and often does mean to announce that you are going back. After a newspaper prints something untrue or unfounded, they issue a retraction.

"git checkout -b" is confusing because the main and most significant thing it does is create a new branch, and checking it out is secondary to that. If it had been "git branch -c" instead (create a branch also check it out) that would have been more natural than "git checkout -b" (check out a branch that, incidentally, you will have created).

"git reset", as you mentioned, does two things. This could have been made easier by just splitting it into two commands. Perhaps the first two forms could be called "git unstage". The git book ( https://git-scm.com/book/id/v2/Git-Basics-Undoing-Things ) explains it under a heading called "Unstaging a Staged File", which suggests that it's a more natural term.

Re:Key Git Concepts Explained the Hard Way by Already__Taken on Thursday March 15, 2018 @06:15AM (#16591564)
git reset should be renamed to git remove, because add is used to add the staging. Or "git add" should be "git stage"

"git remove" should then be "git delete".

Re:Key Git Concepts Explained the Hard Way by erik_seaberg on Thursday March 15, 2018 @11:23AM (#16593613)
The staging area was a mistake because it's hidden in the repo where I can't build and test it. I should be stashing changes I don't want to commit, and then committing the known-good workspace.
Re:Key Git Concepts Explained the Hard Way by tenken on Wednesday March 14, 2018 @03:28PM (#16587567)
I would argue git is not novice friendly. It's original intended audience was not lay people learning how to program. It was seasoned kernel developers working on the Linux source tree. It (made) assumption(s) it's userbase were experts in their domain.

> Naturally, people get confused and reach for the docs, which are filled with even more newbie-hostile terms like 'tree-ish', 'hunks' and 'refspec'.

Yup, these are everyday terms for an expert in computer science and algorithm and software design. If I were a student in medical school I'd expect the books I'm learning from to use the expert terminology of my domain of study when describing the body and functions and not laymans terms such as -- "the hip bone is connected to the Red-Squishy-Thing .... ELI5 me plz" ...

I agree git is complex, and can be scary. But building software is a complicated process rife with engineering pitfalls! If one is unable to properly use the Lego building blocks, then stay away :D

I do believe when used properly, a productive Git workflow using Branches and sane commit messages can help to give Visibility to your project development life-cycle and help to make an issue or task on a project understandable in scope and difficulty by segmenting ones development work into comprehensible mergable pieces (branches) within the project.

Re:Key Git Concepts Explained the Hard Way by masklinn on Wednesday March 14, 2018 @03:41PM (#16587647)
> I would argue git is not novice friendly.

Git is not friendly period, it's a huge pile of leaky abstraction and incoherent commands, the "high-level UI" being closer to shortcuts for common sequences of lower-level operations than an actual abstraction. It simply can not be understood "top-down".

> It's original intended audience was not lay people learning how to program. It was seasoned kernel developers working on the Linux source tree. It (made) assumption(s) it's userbase were experts in their domain.

Domain expertise has nothing to do with it, unless the domain is playing with footguns and expertise is having toes left.

> I agree git is complex

Git is not complex, it just has a very, very shitty API.

Re:Key Git Concepts Explained the Hard Way by microtherion on Wednesday March 14, 2018 @07:22PM (#16589258)
Git and its documentation are a prime example of what languagelog calls "Nerdview": http://languagelog.ldc.upenn.edu/nll/?p=276

    people with any kind of technical knowledge of a domain tend     
    to get hopelessly (and unwittingly) stuck in a frame of 
    reference that relates to their view of the issue, and 
    their trade's technical parlance, not that of the ordinary 
    humans with whom they so signally fail to engage.
Re:Key Git Concepts Explained the Hard Way by acqq on Wednesday March 14, 2018 @08:49PM (#16589673)
Some example of "wrong frame of reference" when "ordinary humans" even include "all other programmers not in his own team":

https://blogs.msdn.microsoft.com/oldnewthing/20110512-00/?p=...

I know a few "nerds" like that. They tend to give technically completely correct but misleading or dangerous or simply unusable answers.

Re:Key Git Concepts Explained the Hard Way by u801e on Wednesday March 14, 2018 @11:36PM (#16590259)
Could this principle not also apply to any journal/conference paper? For the most part, one has to have a basic understanding of the field, and read through prior research to have a better understanding of the current problem domain.

We don't expect journal papers to be written at an elementary level. But people who make an effort to get themselves up to speed in the area can understand them. The same thing applies to a lot of tools that are used in software development.

Re:Key Git Concepts Explained the Hard Way by masklinn on Thursday March 15, 2018 @04:40AM (#16591209)
> Could this principle not also apply to any journal/conference paper?

Git's man pages are not journal papers.

> For the most part, one has to have a basic understanding of the field

"Basic understanding of the field" does nothing for understanding Git.

> and read through prior research to have a better understanding of the current problem domain.

You should not have to "read through prior research" to be able to use a basic VCS tool, literally no other VCS asks that of you, not even Darcs (especially not Darcs, which actually put real effort into a sensible CLI).

> We don't expect journal papers to be written at an elementary level.

We don't expect tooling documentation to require a phd unless the tool's entire purpose is something only a phd would need.

> The same thing applies to a lot of tools that are used in software development.

No. It applies to very few tools that are used in software development. And git most definitely is not one of them.

Re:Key Git Concepts Explained the Hard Way by u801e on Thursday March 15, 2018 @07:46AM (#16591941)
> "Basic understanding of the field" does nothing for understanding Git.

Assuming one has at least read up on data structures, then one would have read about graph structures and have heard about what a directed acyclic graph is.

> You should not have to "read through prior research" to be able to use a basic VCS tool

You should have some understanding of what source control is and have read at least some of the documentation of the VCS tool you are using. I've never used hg and wouldn't know where to start without reading some of the documentation first. But having prior knowledge of VCSs and distributed VCSs would allow me to target my search for documentation about how to commit changes, how to publish them to a remote repository, how to make a branch, etc.

> We don't expect tooling documentation to require a phd

Many of these papers can be read and understood by students who are pursuing their undergraduate degree. But they do need to put some effort into it.

> No. It applies to very few tools that are used in software development.

Can I use grep without a basic understanding of how regular expressions work? Could I use a debugger like gdb without understanding concepts like the call stack and variable addressing? You have to be able to read through documentation to effectively use a lot of tools in software development.

Re:Key Git Concepts Explained the Hard Way by masklinn on Thursday March 15, 2018 @09:02AM (#16592426)
> Assuming one has at least read up on data structures, then one would have read about graph structures and have heard about what a directed acyclic graph is.

Knowing what a DAG is doesn't help using git and Git being singularly problematic despite every DVCS being a dag indicates that DAGs have nothing to do with Git's issues.

> You should have some understanding of what source control is and have read at least some of the documentation of the VCS tool you are using.

Basic understanding of source control and the ability to read correctly-written documentation (which Git's is not) is not "read[ing] through prior research".

> Many of these papers can be read and understood by students who are pursuing their undergraduate degree. But they do need to put some effort into it.

Completely missing the point.

> Can I use grep without a basic understanding of how regular expressions work? Could I use a debugger like gdb without understanding concepts like the call stack and variable addressing? You have to be able to read through documentation to effectively use a lot of tools in software development.

Your original assertion was not the ability to read some documentation (under the assumption that the documentation actually makes sense, which isn't the case for git).

If you're not going to make even cursory attempts at basic honesty and coherence, there's no point to a discussion, enjoy playing with yourself.

Re:Key Git Concepts Explained the Hard Way by u801e on Thursday March 15, 2018 @09:40AM (#16592712)
> correctly-written documentation (which Git's is not)

How does git's documentation fundamentally differ from tools like ffmpeg or grep? That is, what makes it incorrect? I've read through those man pages and have been able to figure out how to use the CLIs for those commands.

>> We don't expect tooling documentation to require a phd

[ ... ]

> Completely missing the point.

Using hyperbole doesn't help you make a point.

> enjoy playing with yourself.

You don't have to resort to using insults.

Re:Key Git Concepts Explained the Hard Way by sneak on Wednesday March 14, 2018 @03:34PM (#16587604)
I know a lot of CS experts who go weeks without saying any of “hunks”, “refspec”, or “tree-ish”. You are making excuses for needless, opaque jargon.
Re:Key Git Concepts Explained the Hard Way by rileymat2 on Wednesday March 14, 2018 @03:49PM (#16587702)
I was a pretty good CS student and do not remember any of those terms outside of git.
Re:Key Git Concepts Explained the Hard Way by jwilk on Wednesday March 14, 2018 @04:18PM (#16587937)
Out of these, only “hunk” is a somewhat common term.

“refspec” and “tree-ish” are obscure and git-specific.

Re:Key Git Concepts Explained the Hard Way by jejones3141 on Wednesday March 14, 2018 @10:57PM (#16590149)
I've always been puzzled about why programmers aren't considered worthy of tools designed with thought given to user interface.
Re:Key Git Concepts Explained the Hard Way by seanmcdirmid on Thursday March 15, 2018 @07:41AM (#16591915)
Very few dev tool organizations employ dev-oriented UX designers. It’s mostly the developers and PMs themselves doing UX design, when they have been evaluated and promoted based on other things (coding, project management).
Re:Key Git Concepts Explained the Hard Way by masklinn on Thursday March 15, 2018 @05:40AM (#16591434)
Because it's hard demanding proper UI when you intuitively know you couldn't build one to save your life, not only does it feel like whining, if it spreads you might be out of a job.
Re:Key Git Concepts Explained the Hard Way by fulafel on Wednesday March 14, 2018 @03:52PM (#16587728)
Yep. It's puzzling how it won over hg. Linux is a powerful mannequin I guess.
Re:Key Git Concepts Explained the Hard Way by IshKebab on Thursday March 15, 2018 @06:03AM (#16591524)
I suspect things would have gone differently if Github supported Mercurial.

Also Git is now more or less locked in to terrible naming for its actions - yes they could be renamed but that would probably cause more issues than its worth. And Mercurial isn't dead yet - Facebook uses it and they're rewriting it in Rust (yeah yeah) to make it faster. I don't think the VCS wars are over yet.

Re:Key Git Concepts Explained the Hard Way by throw7 on Wednesday March 14, 2018 @04:59PM (#16588239)
hg was slow. if linus, at the time, felt otherwise, it might have been hg that "won" when bitkeeper was dropped.
Re:Key Git Concepts Explained the Hard Way by coldacid on Wednesday March 14, 2018 @08:25PM (#16589571)
If Linus, at the time, felt otherwise, git probably wouldn't have been created.
Re:Key Git Concepts Explained the Hard Way by Noumenon72 on Wednesday March 14, 2018 @09:35PM (#16589902)
One of the nice things about my current job is they are still with hg -- we are going to have to switch to start using Bitbucket. I expect Git will be easier to understand the second time around, but I'll never forgive it for making itself so hard to use.
Re:Key Git Concepts Explained the Hard Way by lozenge on Thursday March 15, 2018 @04:47AM (#16591232)
Bitbucket supports mercurial.
Re:Key Git Concepts Explained the Hard Way by kyrra on Thursday March 15, 2018 @02:14PM (#16595227)
Bitbucket Server (on premesis) does not support mecurial.

https://confluence.atlassian.com/confeval/development-tools-...

Re:Key Git Concepts Explained the Hard Way by jcranmer on Thursday March 15, 2018 @01:00AM (#16590497)
The best example I can think of right now as to where git's documentation is unusable: suppose you accidentally git add'd a file, and you want to remove it without deleting it on disk (since, you know, that's your only copy of it). This doesn't come up very often, so there's no way you're going to remember the command off the top of your head. The most reasonable guess is "it sounds like a special rm, so let's look at the documentation for rm."

Here's hg help rm:

    remove the specified files on the next commit
        Schedule the indicated files for removal from the current branch.
        This command schedules the files to be removed at the next commit. To undo
        a remove before that, see 'hg revert'. To undo added files, see 'hg
        forget'.
Oh, I don't want hg rm, I want hg forget. hg help forget confirms this:

    This only removes files from the current branch, not from the entire
    project history, and it does not delete them from the working directory.
Okay, let's ask git help rm:

       Remove files from the index, or from the working tree and the index.
       git rm will not remove a file from just your working directory. (There
       is no option to remove a file only from the working tree and yet keep
       it in the index; use /bin/rm if you want to do that.) The files being
       removed have to be identical to the tip of the branch, and no updates
       to their contents can be staged in the index, though that default
       behavior can be overridden with the -f option. When --cached is given,
       the staged content has to match either the tip of the branch or the
       file on disk, allowing the file to be removed from just the index.

For this to be any use, you have to remember that "index" refers to the staging area and not anything else that might reasonably be presumed to be an index (such as the commit history). Of course, if you knew there was a glossary, you could double-check the definition in the glossary, only to find that the definition (a collection of files with stat information, whose contents are stored as objects) is about as useful as the infamous "a monad is a monoid in the category of endofunctors," but the latter was supposed to be a joke.

Sure, some problems with git may be that people have trouble understanding the concepts. But many of them are due to git's impenetrable documentation and a few of the commands that do too many things. The sheer resistance of many adherents of git to recognize that it has a UX problem is just mind-boggling.

Re:Key Git Concepts Explained the Hard Way by chopin on Thursday March 15, 2018 @03:35AM (#16591019)
In such cases, I look for my problem on stackoverflow. When I find a solution which seems right to me, I look up https://git-scm.com/docs to get a better understanding of what I am doing and why.

The problem with many documentations is that they are not use-case driven. Much of it is a functionality description. Such as:

- To fasten, you have to turn the nut clockwise.

instead of:

- To fit these two parts together you need to fasten the nuts onto the screws.

Re:Key Git Concepts Explained the Hard Way by snaily on Thursday March 15, 2018 @05:57AM (#16591500)
At some point, git status started showing the commands for moving changes in and out of the index, and it is an amazing timesaver for me.
Re:Key Git Concepts Explained the Hard Way by dralley on Wednesday March 14, 2018 @04:48PM (#16588164)
Not to mention that the most common way of creating a branch is by using git checkout, and it also reverts files, and also switches branches, again all based on what flags you feed it
Re:Key Git Concepts Explained the Hard Way by stouset on Thursday March 15, 2018 @12:42AM (#16590439)
`git checkout` has one main responsibility: take stuff from a commit and put it on the filesystem (and put it in the index as well).

All of its functionality is simple variants on that. `-b` is the only real odd man out, and it’s just a shortcut for calling `git branch $branchname` first.

Re:Key Git Concepts Explained the Hard Way by tjr225 on Thursday March 15, 2018 @12:24AM (#16590387)
Git is much like Vim...user-unfriendly on the surface...but user friendly at the core. It is a simple tool that works, but is hard to understand for the beginner.
Re:Key Git Concepts Explained the Hard Way by jcranmer on Thursday March 15, 2018 @01:02AM (#16590508)
There's one key difference: vim's user manual is useful. git's user manual is not (see https://news.ycombinator.com/item?id=16590497 for an example).
Re:Key Git Concepts Explained the Hard Way by IshKebab on Thursday March 15, 2018 @06:04AM (#16591526)
Yeah that's not an excuse though. It could easily have been user-friendly on the surface too!