The traditional approach to teaching git is to start with the details of how git stores and indexes content and build upon that to get to the commonly used commands. This method does give you a really good understanding of what is going on under the hood. It does a very good job of explaining exactly what happens when you create a branch, rebase or merge. However, it gets lost in the mechanics and the specific commands and doesn’t do a great job of explaining why you might want to to do these things or how they fit into the bigger picture. It’s easy to get lost in the sea of details. This approach is exemplified by “Version Control with Git”. “Git For Teams” by Emma Jane Hogbin Westbay is different.
The subtitle is “A User-Centered Approach To Creating Efficient Workflows in Git”. It approaches the issue from the top down. It talks about common workflows and common tasks you might run into and then talks about how to use the git commands to then execute those tasks. This is a great idea. Workflows are very important and understanding when and why to create a branch and merge or rebase is really useful and has been missing from the discussion around git.
The first third of the book talks about high-level workflows. It talks about various types of projects. She starts by looking at the various environments in which we write software such as an open source project versus a private corporate project, a project with trusted developers versus untrusted developers, projects that are continuously deployed (like a website/webservice) versus projects that have a definite maintenance and release cycle. These all have unique requirements that drive different workflows.
We need to be able to adapt our git workflow to our unique constraints. I think this is one reason why git has become so popular. It’s certainly not popular for its wonderful user experience. But it is very flexible in the workflows that it allows. I found the section on workflows very interesting because I didn’t realize there were so many different (and entirely valid) ways to use git. The problem is one of too many choices.
She also talks a lot in these chapters about the people side of all this. She talks a lot about coordination and communication. She also talks about empathy and leadership. She also talks about trust. All of these things affect how we use git and how we design our workflow.
Applying the Commands to Your Workflow
The first step was to define your workflow. The next step is to figure out how to use the git commands to implement it. This is really the most useful part of the book. She lays out a lot of common scenarios you might run into. For example, she talks about how to undo a merge or how to pull down someone’s changes to review a pull request. Most of her examples are very practical.
What’s great about her explanations is that she uses some nice graphics and flowcharts to represent what is going on and help walk people through all the steps. It’s worth buying the book for those alone. She encourages groups to write their own flowcharts, which I think is a great idea!
Chapter 6 on Rollbacks, Reverts, Resets, and Rebasing is very useful. It covers how to undo a lot of things. If you ever find yourself going back and trying to undo a commit or reverse a change, this is the chapter for you. Specifically, she talks about how to do these things in a way that doesn’t alter history for things that you have already shared with others.
The third part of the book talks about different online hosting platforms such as Github, GitLab, and Bitbucket. I honestly found this section less useful. If you have never played around with any of them before then you might find it useful.
I like the book. I think it is a good addition to my library. I learned a lot by reading it. I am sure I will refer to it a lot. I like the fact that it talks about the people side of things which I think is often ignored in tech literature.
I feel like for teaching a complete beginner neither of the two approaches to teaching git works well on its own. Teaching workflows first is good but it’s hard to implement them without understanding how git works internally. By the same token, learning all the internals is not very useful without understanding the bigger picture. I think the best approach to teaching a beginner to use git is to blend both approaches.