Live data from Hacker News

Git koans

stevelosh.com

1–10 of 143 posts

Re: Git koans

#2
Short of me downing distressing amounts of coffee, could someone explain these please for those of us still trying to grok git?

Re: Git koans

#3
The 'Only the Gods' one seems weird to me; maybe I just don't understand Git well enough, but it seems like that one's just a case of failing to understand what a branch is.

A particular commit isn't made 'on' a branch, so to speak; it's just a SHA hash that has a particular SHA as a parent. And then a branch is a pointer to a particular SHA. So there's no way to know which branch a commit originated 'on', merely which branches happen to contain a commit at present (because their current commit has the desired commit in its history).

So, if you merge two branches together, of course you can not tell which branch a given commit originated on just by looking at history. That information was never in the history in the first place.

I could see it being useful to track this in the merge somehow, though.

Re: Git koans

#6
post #2

Short of me downing distressing amounts of coffee, could someone explain these please for those of us still trying to grok git?

It's a list of pitfalls which are all too easy to fall into.

The somewhat inconsistent command line interface / option / argument parsing in git can sometimes lead to very unexpected results.

Re: Git koans

#8
Has anyone made an alternative interface for git that tidies this up without drastically changing how you use git? Or would this condemn someone's sanity to the graveyard?

Re: Git koans

#10
post #2

Short of me downing distressing amounts of coffee, could someone explain these please for those of us still trying to grok git?

I'm not sure what Silence is about. My git-config-fu fails me.

One Thing Well demonstrates how one command (git checkout), while it does do 'one thing well' (changing your working directory to match something in the index), can handle a wide variety of seemingly unrelated use cases.

Only the Gods demonstrates how history can mean different things: commit parentage, which is usually immutable, and branch history, which is ephemeral.

The Hobgoblin probably refers to the Emerson quote "A foolish consistency is the hobgoblin of little minds."

The Long and the Short of It is about how git accepts `git --help command`, `git command --help`, and `git command -h` but `git -h command` returns an argument error.

A theme here is that git does not try to anticipate your workflow. Its commands and options are named based on what they do, rather than how you should probably use them. This makes git a very powerful tool, but with an interface that is often counter-intuitive.

Post reply on HN