Home » Book Reviews

Pragmatic Version Control Using Git

16 December 2008 1,666 views One Comment

Pragmatic Version Control Using Git By Travis Swicegood
Publisher: The Pragmatic Programmers

The book is currently in Beta so only available electronically. 
To buy the PDF now with the paper edition shipped when its complete is $43.75 or you can purchase just the PDF for $22 

Buy Direct From Publisher 

Review By Diego Zamboni 

Summary
Pragmatic Version Control Using Git provides a good overview and introduction to using Git for version control. The book covers all the basic concepts of distributed version control systems (DVCS), and provides a hands-on guide to all the basic Git features, and some advanced ones. The book is well written, in general the examples are useful and serve to clearly illustrate the points, and the book provides enough information to get started and exploring on your own. It does not contain a lot of advanced usage of Git, nor is it a Git reference tome, but after reading it, you will have enough knowledge to dig through the ample git documentation and discover all the functionality that is not described in the book. 

If you are coming from Subversion or CVS, the book will allow you to quickly become productive with Git. There is a short guide in the Preface that points to the parts that you may want to skim and where you need to start paying more attention. 

Overall, a highly recommended read if you want to get introduced to the world of distributed version control systems and to Git. If you are expecting a full reference to Git and its advanced techniques, this book may not be for you. 

Full review
I have been using version control systems (VCS) for a long time, starting with RCS, then CVS and more recently Subversion. I had been interested for some time in learning to use one of the “new generation” of distributed VCS (DVCS), so I jumped at the opportunity of reviewing
 Pragmatic Version Control Using Git, by Travis Swicegood. 

I reviewed a Beta version of the book, which essentially means a PDF of the book still in its production stages. At this stage the book was content-complete, but still without a full editorial pass, which meant there were typos here and there. All of those should be gone in the final version of the book, whether you buy it as a PDF or in paper 
form. 

In a nutshell, this book covers everything you need to know to start using the Git Distributed Version Control System (DVCS). To give you some background, Git was designed from scratch by Linus Torvalds, the main author of the Linux kernel, after he became dissatisfied with the ability of other VCS to gracefully handle the large scale and largely distributed nature of Linux kernel development. 

The book is composed of the following chapters: 

Part I: Welcome to the distributed world 
Ch. 1: Version control the Git way 
Ch. 2: Setting up Git 
Ch. 3: Creating your first repository 

Part II: Everyday Git 
Ch. 4: Adding and committing: Git basics 
Ch. 5: Understanding and using branches 
Ch. 6: Working with Git’s history 
Ch. 7: Working with remote repositories 
Ch. 8: Organizing your repository 
Ch. 9: Beyond the basics 

Part III: Administration 
Ch. 10: Migrating to Git 
Ch. 11: Running a Git server with Gitosis 

Appendix A: Git command quick reference 
Appendix B: Other resources and tools 
Appendix C: Bibliography 

If you are an experienced VCS (e.g. Subversion or CVS) user that is new to Git, I would recommend reading Chapter 1 to get introduced to the concept of a distributed VCS and to the terminology used in the Git world, and if needed, to look at Chapter 2 to find the best way to install Git on your system. You can then skim through Chapters 3 and 4, which contain an overview of the basic operations in Git, and are 
similar to what you know from other VCS. 

The book uses the same sample repository from start to finish, a fictional web site containing multiple files. You start by creating the repository and make many changes throughout the book. The examples are in general very useful and clearly demonstrate the concepts being discussed. Each chapter begins with the instructions for checking out a version of the repository as it should be at that point, so that you 
can follow the examples even if you have skipped some sections or modified it beyond recognition with your previous experiments. 

The really good stuff starts in Chapter 5, where you will start to realize some of Git’s unique abilities. In Chapters 5 through 9 You will learn about branching, tagging and merging, including cherry-picking, squashed merges and rebasing; history examination and manipulation (these abilities are mind-bending for someone coming from a centralized-VCS system); remote repositories; git submodules (equivalent to svn:externals); repository maintenance, cleanup and organization, including a lot of best-practice advise on how to handle releases, bug fixes and other tasks using tags and branches; and a unique git feature called “bisect” which allows you to semi- or 
fully-automatically narrow down the commit that introduced a bug. 

I found the treatment of remote repositories to be one of the weakest points of the book in terms of clarity. For example, the difference between “git clone”, “git fetch” and “git pull” is not made clear through examples. I also found it not obvious from the explanations how remote branches and local branches are related to each other when you want to push your changes back to the remote repository. This is explained in the text, but the use of detailed examples would have made it much clearer from the beginning. 

The sections dealing with some of the more advanced features (such as submodules and git bisect) also have fewer examples, and those that are provided are disconnected from the repository that you have been building throughout the book. This detracts from the clarity of the explanations, and I wish the author had provided some extra ready-made repositories to demonstrate some of these techniques. 

Chapter 10 deals with migrating to Git from Subversion and CVS. It covers the basic operations, but again I found the treatment of remote repositories to be the weakest point, in this case the mapping of local Git branches to remote Subversion branches. 

Chapter 11 guides you through using Gitosis, a clever system that allows you to set up and administer your own Git remote repositories, with all the operations being done through Git itself. This chapter assumes you are setting up Gitosis on a Linux server. If you are installing it on an OS X machine, you need to make the following 
adjustments: 

- The useradd command does not exist in OS X, but you can create the user using the regular OS X mechanisms (e.g. the Accounts preference panel). 

- After creating the user, you need to create a .bashrc file in the home directory of the gitosis user to add the appropriate directories to the PATH environment variable, so that the gitosis and git commands are found. In my case, the file contains: 

#!/bin/bash 
export PATH=$PATH:/usr/local/bin:/usr/local/git/bin

The book concludes with a git command reference, and a list of useful tools, web sites and other resources about Git. 

In conclusion, I would highly recommend Pragmatic Version Control Using Git as a way to get introduced to Git. The drawbacks I mentioned are minor compared to the value provided with the book, and quickly solved with a little experimentation and reading of the Git documentation. If you are familiar with CVS or Subversion, this book will give you everything you need to start using Git productively. 

About Diego Zamboni
Diego Zamboni is a researcher at the IBM Zurich Research Lab, where he works in computer security, specifically intrusion detection and virtualization security; and a beginning Mac developer, who has learned a lot by experimenting and reading other people’s code, but is only now reading Aaron Hillegass’ book. He has used and administered Unix systems for almost 20 years, has been programming for even longer, since he got his first computer (a TS1000), and has been using Macs for the last eight years. He lives in Zurich, Switzerland with his beautiful wife and two daughters.

One Comment »

  • Chris Kimpton said:

    Thanks for the review – I think I will get this book.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.