
Git Magic - llambda
http://www-cs-students.stanford.edu/~blynn/gitmagic/
======
yuvadam
All these git tutorials are nice, and they might be beneficial for some
people.

Personally, I find all these supposedly-helpful analogies useless and
confusing. If I start to learn git, I would rather someone just tell me three
things:

1\. Git saves 'entire' snapshots of a directory on each commit. 2\. Each
commit resides in a graph and has a pointer to its parent 3\. The only commit
with more than one parent is a merge commit - which carries data on how to
merge two previous commits.

~~~
js2
<pedantic>There are also root commits that have zero parents (a repo can have
multiple roots). A merge commit differs _only_ in that it has more than one
parent; it otherwise carries no additional data compared to any other
commit.</pedantic>

The special treatment that you see when you "git show" a merge commit is
computed by comparing the merge commit's tree to its parents' trees.

I'd also add a (4) to your list: a branch is a pointer (a "ref" in git jargon)
to a commit that is updated to the most recent commit each time you create a
new commit.

Oh, and maybe (5): HEAD is usually an indirect pointer to a commit via a ref,
but can also point directly to a commit in which case it is a so-called
detached HEAD.

~~~
icefox
You can even have repositories that only have root commits. I have a git hack
that stores blog entries in a git repository. Each entry is a root commit with
one branch that points to all of the root commits. A fun crazy hack.

~~~
loup-vaillant
This is where I like Darcs. Your hack is actually the default there, because
it is "obvious" that a patch representing a new blog entry doesn't depend on
anything.

There, reverting any such patch would simply delete your entry without any
more question (unless of course you committed _another_ patch on top of it to,
say, correct spelling). I assume this is the kind of advantage you get from
your hack?

~~~
icefox
Yup I saw it a each "blog entry" being its own repository with its own history
of corrections, updates etc. There was multiple master branches that groups
blog entries such as "public" or with other tags. The _real_ fun came because
you could publish your git repository and when someone fetched it if they say
used http they would only get the public branch and all those commits, but if
you fetched using the key "bob" you could get all of the refs that were both
public and bob. Those on the public branch would never know that they are
missing refs because they have separate roots. And just to make things more
fun you could have encrypted messages to boot with private keys.

------
arscan
So, off topic a little here, but does anybody else find the "title" attribute
on the main content divs to be very irritating? Apparently I read with my
mouse cursor sometimes (I didn't realize I did this), and that pesky "title"
attribute constantly causes a tooltip to get in my way.

~~~
malingo
Yes that has bugged me quite a bit; I first noticed it when reading his essay
on C [1]. But since then I've installed Vimium [2] and I never even touch the
mouse anymore.

[1] <http://www-cs-students.stanford.edu/~blynn/c/>

[2] <http://vimium.github.com/>

~~~
arscan
Thanks, for both links

------
graywh
Previous discussions:

<http://news.ycombinator.com/item?id=161867>

<http://news.ycombinator.com/item?id=267462>

<http://news.ycombinator.com/item?id=1064027>

------
charolastrauno
I'm sitting next to Ben right now, and he's blushing at all the attention. He
says he keeps meaning to do a v2.

Anyway, if you really like this, you should consider getting a physical copy:
<http://www.amazon.com/Git-Magic-Ben-Lynn/dp/1451523343/>

~~~
chimeracoder
Any chance of a Kindle/ebook version? It's already free online, but it might
make for a bit more pleasant reading on a tablet/mobile device.

~~~
FraaJad
The source[1] is in asciidoc format, use a2x [2] to convert it to epub.

[1] git clone git://repo.or.cz/gitmagic.git [2]
<http://www.methods.co.nz/asciidoc/a2x.1.html>

------
manojlds
What do they mean by the below in the Git shortcomings section:

Git on MSys is an alternative requiring minimal runtime support, though a few
of the commands need some work.

Need some work on what? I hate it when some statements are made without giving
any explanation

~~~
JBiserkov
From ReleaseNotes.rtf

Known issues -Some commands are not yet supported on Windows, namely: git
archimport, git cvsexportcommit, git cvsimport, git cvsserver, git instaweb,
git shell. -git and bash have serious problems with non-ASCII file names
(Issue 80, 159)

There are other known issues, but I think those are the most important.

------
ljlolel
There are simpler tutorials: [http://www.jperla.com/blog/post/teach-yourself-
git-in-2-minu...](http://www.jperla.com/blog/post/teach-yourself-git-
in-2-minutes)

~~~
mister_m
This is hard for me to understand with the abbreviated commands.

------
wsxiaoys
The Simplified Chinese version looks like a machine translation.

------
aiscott
I didn't think I would like this. I'm a nuts and bolts kind of person and I
like to try to understand from the ground up if I can.

However, this is a pretty good narrative, and is filling in some blanks for
me. For instance, the _git whatchanged_ command was new to me.

