6

Interactive Rebasing

Interactive rebasing is a confusing name for a very useful Git functionality. From a user's perspective, rebase and interactive rebase have little in common.

Interactive rebase allows you to clean up your commits, but only before you push them to the server. With interactive rebasing you can:

  • "Squash" your commits so that your commit history is sparser and easier to read
  • Modify the message for your commits
  • Fixup, which is just like squash except that it doesn't stop and ask for a new message
  • Drop, which removes a commit

The key thing here is that you are modifying commits, not the files that go into a commit. And, as I'll keep mentioning, you must do this interactive rebasing before you push your commits to origin. ...

Get Git for Programmers 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.