{"id":355658,"date":"2021-11-12T07:16:24","date_gmt":"2021-11-12T15:16:24","guid":{"rendered":"https:\/\/css-tricks.com\/?p=355658"},"modified":"2021-12-03T07:49:23","modified_gmt":"2021-12-03T15:49:23","slug":"interactive-rebase-clean-up-your-commit-history","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/interactive-rebase-clean-up-your-commit-history\/","title":{"rendered":"Interactive Rebase: Clean up your Commit History"},"content":{"rendered":"\n

This article is part of our \u201cAdvanced Git\u201d<\/a> series. Be sure to follow Tower on Twitter<\/a> or sign up for their newsletter<\/a> to hear about the next articles.<\/p>\n\n\n\n

Interactive Rebase is the Swiss Army knife of Git commands: lots of use cases and lots of possibilities! It’s really a great addition to any developer’s tool chain, because it lets you revise your local commit history\u2014before you share your work with the rest of the team.<\/p>\n\n\n\n

Let’s see what you can do with an interactive rebase and then look at some practical examples.<\/p>\n\n\n\n\n\n\n\n

Advanced Git series:<\/h4>\n\n\n
  1. Part 1:<\/strong> <\/a>Creating the Perfect Commit in Git<\/a><\/li>
  2. Part 2:<\/strong> Branching Strategies in Git<\/a><\/li>
  3. Part 3:<\/strong> Better Collaboration With Pull Requests<\/a><\/li>
  4. Part 4:<\/strong> Merge Conflicts<\/a><\/li>
  5. Part 5:<\/strong> Rebase vs. Merge<\/a><\/li>
  6. Part 6:<\/strong> Interactive Rebase<\/a> (You are here!<\/em>)<\/li>
  7. Part 7:<\/strong> Cherry-Picking Commits in Git<\/a><\/li>
  8. Part 8:<\/strong> Using the Reflog to Restore Lost Commits<\/a><\/li><\/ol>\n\n\n\n

    <\/p>\n<\/div><\/div>\n\n\n

    Rewriting your commit history<\/h3>\n\n\n

    In short, interactive rebase allows you to manipulate your commit history. It’s meant for optimizing and cleaning up. You can…<\/p>\n\n\n\n