Chapter 4. Rebase Regularly and Interactively, and Other Use Cases

In this chapter, we will cover the following topics:

  • Rebasing commits to another branch
  • Continuing a rebase with merge conflicts
  • Rebasing selective commits interactively
  • Squashing commits using an interactive rebase
  • Changing the author of commits using a rebase
  • Auto-squashing commits

Introduction

Rebase is an incredibly strong feature of Git. Hopefully, you have used it before; if not, you might have heard about it. Rebasing is exactly what the word implies. So, if you have a certain commit A that is based on commit B, then rebasing A to C would result in commit A being based on commit C.

As you will see in the different examples in this chapter, it is not always as simple as that.

Get Git: Mastering Version Control 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.