Live data from Hacker News

How to teach Git

rachelcarmena.github.io

31–40 of 273 posts

Re: How to teach Git

#31
I found this very helpful: http://eagain.net/articles/git-for-computer-scientists/. Git's data structures are well designed. Once you have internalized them, you will be better equipped to navigate through the jungle of command-line options.

To understand the data structures interactively, use "git cat-file -p HEAD" and continue drilling down to an individual file in a subdirectory with "git cat-file -p OBJECTHASH"

Re: How to teach Git

#32
post #5

Personally, I think using git from the commandline is too complicated for the purpose it serves in most companies. Using a git GUI works quite well for people inexperienced with git.

Same here. I am using Git for over 10 years now (with breaks), but I always pain me getting into the CLI (apart from basic add/commit/push/pull). Almost all commands require flags to give you a decent behaviour and the documentation is seriously lacking.

For example, I've never had any problems with Mercurial. Everything just works there and it is intuitive. You can never lose data there, and it has extremely sensible defaults.

Re: How to teach Git

#34
post #8

Earlier quoted context omitted.

Isn't the staging area closer to an intermediary box? That's where it can get confusing.

Staging puts things in the box, commit closes the box, puts it on the pile with the other boxes, and gives you a new empty staging box.

But why is it an extra step? It's basically just a "longterm" selection of what you want to commit.

Re: How to teach Git

#35
post #15
post #5

Personally, I think using git from the commandline is too complicated for the purpose it serves in most companies. Using a git GUI works quite well for people inexperienced with git.

Even for experienced people, I rather spend my time on GUI tools and only drop into the CLI on as needed basis. From UI/UX point of view, developers are users as well, but many seem to think developers should put up with bad interfaces.

I'm in the same boat. When I do something bad CLI helps me fix it, but otherwise an interface is really useful for me.

Re: How to teach Git

#36

Earlier quoted context omitted.

> WHY there is a staging area I understand your second point, but I have a hard time understanding the difficulty with this part. Why is it hard for people to understand the idea of staging? You put things in a box one at a time before closing the box. Does it require more explanation than that? What do people find difficult about it?

So I have a solid mental of git, and I understand the theoretical need for the staging area. However, I find the occasions for using the staging area in practice are few and far between, for the simple reason that I can't test and execute the code that's in the staging area without also having the code from the working directory also be there. It feels like after having partially staged some of my working directory,…

I use it quite a lot, especially with `git add -p` to stage only parts of a file for an atomic commit.

Re: How to teach Git

#37
post #11

Earlier quoted context omitted.

> WHY there is a staging area I understand your second point, but I have a hard time understanding the difficulty with this part. Why is it hard for people to understand the idea of staging? You put things in a box one at a time before closing the box. Does it require more explanation than that? What do people find difficult about it?

People are very used to the web "save always" style: There is one document, and you're editing it. Most people will be familiar with the traditional desktop "save" model where you have to do something to make your changes permanent. People often then learn that there is a local file and some remote file: they can cope with a save -> upload workflow. Lots of traditional VCS turn this into a save -> commit workflow. Gi…

The don't need to understand the internals for this: just knowing that every save you do will be stored forever as-is makes you double-think about what you put inside

Re: How to teach Git

#38
I disagree with this idea. The best way to learn git is to read the git book, in this order: chapters 1, 10, 2, 3, and the rest at your discretion. This way teaches you about the internals first, and if you understand the internals the rest of git is pretty intuitive.

https://git-scm.com/book/en/v2

Re: How to teach Git

#39
The best way to learn git is to learn what's happening at the DAG level. That way you can think about what should happen on the DAG and then think of how you can use git to achieve that. For example, a fast-forward merge and a reset can be used to achieve the same thing.

It's also very important to learn to use the reflog. When I was learning to climb they told me I'd never get really good until I'd fallen once. The same thing goes for git. People are really scared of it because they think they could lose work or something. Thanks to the reflog and the way git works, that's actually quite difficult to do.

Re: How to teach Git

#40

I found this very helpful: http://eagain.net/articles/git-for-computer-scientists/ . Git's data structures are well designed. Once you have internalized them, you will be better equipped to navigate through the jungle of command-line options. To understand the data structures interactively, use "git cat-file -p HEAD" and continue drilling down to an individual file in a subdirectory with "git cat-file -p OBJECTHASH "

I've never had to understand the internals of a web browser or text editor in order to use it; drivers ed courses don't start with a discussion of thermodynamics. Why should it be necessary for git?
Post reply on HN