5.3 Merging Changes Between Branches

These branches are great for organizing your repository, but you need to be able to share changes between branches. This is done through merging.

Merging does exactly what it sounds like. It takes two—or sometimes more—branches and merges them into one. There are a couple of different ways to merge changes between branches. This section covers the following:

  • Straight merges take the history of one branch and the history of the other branch and attempt to merge them together.

  • Squashed commits take the history of one branch and compress—or “squash”—it into one commit on top of another branch.

  • Cherry-picking a commit pulls a single commit from a different branch and applies it to the current branch. ...

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.