1.8 Merging

In our Choose Your Own Adventure story, Joe’s path when we met him had two distinct routes: into the cave or out of the forest. Often, the plot lines would come back together later in the book, though.

He might start off going through the cave but end up on the banks of the same river that flowed alongside the forest that he left. Sometimes the author runs out of places to send our hero Joe, so he has to go down the same path but get there multiple ways.

Likewise, having a couple—or even dozens—of branches is OK, but their paths will sometimes need to come together. This is where merging comes in.

Merging is taking two or more branches and combining their history into one. Git goes about merging the same way you might. It compares ...

Get Pragmatic Version Control Using 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.