Chapter 9Merging Content

This chapter introduces the Git model of merging branches as well as the merge types that are supported in Git. I also discuss the Git rebase functionality—a sort of merging with history—and the more selective operations that allow you to merge in an individual commit. Finishing out the main part of the chapter, I discuss how Git deals with conflicts and how you can resolve them.

In the Advanced Topics section, I discuss some advanced rebase functionalities, including interactive rebasing that allows for updating a set of commits already in the repository.


As you've previously seen, Git stores changes at the granularity of a commit—a snapshot of your entire working directory tree at a point in time. You've also learned that each commit has the potential to become a branch and that a branch in Git is really just a named, moving pointer that points to a commit, which, in turn, points to other commits in the chain.

Given that a branch points to a commit and that a commit is the granularity that you associate changes with, it shouldn't come as a surprise that when I talk about merging in Git, I'm talking about merging at the branch or commit level. Thus the command for merging assumes you are dealing with a SHA1 ...

Get Professional Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.