Running Rebase

What

The git rebase command updates your active feature branch by lifting its unique commits, sliding in all new commits from a target base branch (like main), and replaying your feature commits back on top of that updated foundation.

How

To bring changes from main into your current active feature branch, run the rebase command while standing on your feature branch:

# Ensure you are on your feature branch
git branch
# Output: * update_dune

# Rebase the active branch's commits on top of 'main'
git rebase main

During this rebase process, Git will:

  1. Identify the latest commit of the base branch (main) and use it as a temporary new baseline.
  2. Replay each of your feature branch’s unique commits on top of that new baseline.
  3. Update your feature branch pointer to reference the final replayed commit.
  4. Note: The target base branch (main) is completely unaffected by this command.

Why

Rebasing is highly valuable when working on a long-lived feature. If other team members commit code to main while you are writing code, your feature branch becomes stale. By rebasing your feature branch onto main periodically, you integrate all their updates and verify that your feature still compiles and behaves correctly alongside the latest changes.

Summary

Run git rebase <base_branch> from your active feature branch to temporarily lift your unique changes and replay them on top of the latest commits from the base branch.