0PricingLogin
Git & GitHub Professional Workflow · Lesson

Rebasing vs. Merging

Compare and contrast rebasing and merging, learning when to use each for a clean and linear history.

Merge or Rebase? The Choice

When working with Git, you often find your branch diverging from another, like your feature branch from main.

How do you bring those changes together? Git offers two primary strategies: merging and rebasing. Both achieve integration, but they do so in fundamentally different ways, leading to different project histories.

Merging: Combining Histories

Merging is Git's default way to integrate changes. When you merge one branch into another, Git takes the content of the source branch and combines it with the target branch.

The key characteristic of a merge is that it creates a new merge commit. This commit has two parent commits, explicitly showing that two divergent histories were brought together. It preserves the exact history of both branches.

All lessons in this course

  1. Feature Branch Workflow
  2. Gitflow Workflow Introduction
  3. Rebasing vs. Merging
  4. Trunk-Based Development
← Back to Git & GitHub Professional Workflow