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

I've had to get quite a few people up to speed on Git. What I've found is that for most CS-oriented people, beating around the bush is really just getting in their way. If you create the correct mental model for them, much of git becomes self evident. This isn't easy and takes a couple of days of intermitent whiteboarding but everything 'clicks' soon enough.

Big things:

Explaining that the object name (d56abc..) is really a SHA1 hash of all the contents. Git then uses this name to uniquely identify Git Objects.

Git Objects consist of: blob (file), tree (directory), commit (pointer), tag (well.. its a tag..). When you do a "git checkout" you interact with commit objects. When you do a "git ls-tree master ." you are looking at a tree object.

Branching is done by putting the following in .git/refs/heads/branch_name: d56abc..

And a branch will always just point to a commit object.

Finally, the working directory is of very little concern to git. It has handy functions to drop some of its stuff there for you and it can tell you some differences between its HEAD and your files, but really Git begins at the Index.

+ Lots of little things.

Edit: It is always fun to do a quick 'echo "dbc123.." >> .git/refs/heads/new_branch' and show someone that that is all it takes. It really quickly shows how not-scary git is. There is a ton of complex technology that enables its awesomeness but it is a relatively simple system.



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

Search: