By Jake Edge
April 13, 2009
Given the ubiquity of Git as a version control system throughout the free
software community, one would expect there to be more books about it. So
far, that is not the case—though there are indications that is
changing—so Travis Swicegood's Pragmatic Version Control Using
Git is welcome for those trying to come up to speed on Git. Overall,
the book provides a nice starting point, though there are some rough
spots.
Like any book covering a free software package, this one begins with some
important basics: where to get and how to install the tool.
For Linux
users, this guide is probably unnecessary as Git is packaged for most
distributions these days—Mac OS X or Windows users may find more of
interest. The discussion of Git configuration, along with the reminder to
set the user.name and user.email parameters before doing
any commits, something that I regularly forget when setting up a new machine,
is quite useful for all.
Unlike some
other authors, though, Swicegood takes the time to give a bit of the flavor
of Git through a discussion of its concepts—along with some indication
of why one might want to use it—before descending into the
much more boring installation guide. He takes a "30,000 foot" view of the
tool and, with no command syntax or specific usage details, spells out what
Git can do.
One of the primary problems that any text on a version control system (VCS)
must overcome is the need to give "real-world" examples while still keeping
the book to a reasonable size. Swicegood does a good job here, by
following one example repository throughout the text. One could quibble
with the scope of some of his examples, but, by and large, they give a good
idea of how things work. In some ways, the simplicity of those examples
appears to encourage curious
readers to do some experimentation. That is, after all, a pretty good way
to learn how to use a tool.
The book is broken up into three main sections (plus an Appendix with a
reference and some pointers to more information), but the meat of the text
is in Section II, "Everyday Git". For whatever reason, the last chapter of
the first section covers setting up local repositories as well as cloning
remote repositories. That might make sense, but it is rather puzzling that
it starts talking about things like git rebase, branches, and
doing releases here. Much of that is covered in further detail later and
it doesn't seem to belong.
In Section II, the book does an excellent job of covering how to use Git on
a day-to-day basis. I have found myself referring to it several times since
reading it to remind myself of the syntax of a command—or the name of
a command itself. The sequence is logical, starting with adding and
committing files, moving through branch creation and management as well as
examining and working with history in Git, and completing the core with a
look at remote repositories. Two additional chapters covered somewhat more
advanced—or just less often used—features such as organizing
the repository and working with multiple remote projects as well as things
like compacting a repository and working with the reflog.
Swicegood uses the term "staging" for what is commonly referred, at least
in other Git documentation, as the "index". Some readers, especially if they
are already well-versed in Git, may find this a bit confusing, but I found
that it made sense and, in some ways, simplified the concept. In any case,
it seems clear that is how Swicegood envisions the Git index, so passing it
along to his readers is a nice touch.
There is no specific mention of the Git version covered by the
book—though some early examples mention 1.6.0.2—which is a
rather large oversight. Git development moves rapidly, so some of what
Swicegood talks about could well be out-of-date. New Git features, such as
the unmentioned git stash, were left out, but it isn't clear
whether that was done on purpose or because they were added after the book
was completed. Most of what is covered should be unaffected, though, as the
basic operation of the tool is fairly stable.
The third, thinnest and weakest section is "Administration", which
covers migrating to Git and running Git servers. Both chapters seem to
suffer from a lack of breadth. In the migration chapter, nothing but CVS
or Subversion are considered, and tools like tailor are not even
mentioned.
Two things about Swicegood's choices of Git features stood out in a
negative way. He seems overly enamored of git rebase, which
certainly has its place, but it has some drawbacks that he doesn't fully
caution against. His solution for how to create a repository for others to
use was somewhat unsatisfying; Git itself can be configured to support such
things. Instead, Swicegood reaches for Gitosis, a Python tool for managing
remote git repositories. The project seems to have no web page (other than
a gitweb page) and
one must install it by cloning its repository. Given that there is no
mention of how to "manually" set up a Git server, it all seems a bit strange.
There are a handful of less-substantive complaints I could make as well: a
throwaway George
Santayana quote on the history chapter was a bit annoying, an embarrassing
"EMCAScript"
typo in one of the examples stood out, as did a few other minor flaws. Swicegood
complains frequently about having to truncate or otherwise modify the
output of commands to fit on the page, which seems a bit silly. Either fix
the problem somehow in the production process or ignore it to the extent
possible; involving the reader in the pain of the typographic process
seems unnecessary. But these are nits.
While I had some complaints—it is a rare book indeed where I
don't—Pragmatic Version Control Using Git has certainly found
a spot for itself on my shelf. It especially shines as a quick reference
to commands needed daily or nearly so. It will also provide a good
starting point for those who wish to learn Git from scratch. Once other
Git books come out, it will be interesting to see which end up on my shelf
and which are shuffled off to long-term storage. In the end, that is
the best test for a good book.
(
Log in to post comments)