02 December 2015

How I finally learned git

“Einstein repeatedly argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. Much of the complexity he must master is arbitrary complexity […] because they were designed by different people, rather than by God.” —Fred Brooks

True facts:

  • git has outstandingly bad UI design.

  • The git man pages are written in such heavy jargon that I was never able to get anything useful out of them until very recently.

I just recently broke through some sort of internal motivational barrier and really learned git. Here’s what I did:

  • Promise to give a talk about git in front of a bunch of people. I can’t recommend this, but it happened.

  • Read the Pro Git book. Nope. I tried several times, and the book is good and free, but for some reason I couldn’t get through it.

  • Keep a list of my open questions. This is what really worked for me. I made a file (ignorance.md) containing stuff like:

    • What exactly is HEAD?

    • What exactly is the reflog?

    • What exactly is the index? How is it stored?

    • How does git pull differ from git pull origin master?

    • What is this `origin/master` syntax? When would I want to use it?

    Then I attacked questions in no particular order, plugging them into Duck Duck Go or messing around with git in a throwaway repo.

    When I got an answer, I typed it into the file, in my own words. Each answer led to three or four new questions, so I put those in there too, and kept going. Right now I have 39 open questions. (“[W]e do not yet know all the basic laws: there is an expanding frontier of ignorance.” —Richard Feynman)

  • Poke around in .git. There’s no substitute. (“Show me your flowcharts…”)

  • Randomly read GitGuys.com. It’s incomplete, but what’s there is great.

I don’t think all this took more than maybe 8 hours, really. At some point, the git man pages started making sense... mostly.

I would try that ignorance.md thing again. It’s been fun.