Git Rebase Interactive

What I Learned

Git’s interactive rebase (git rebase -i) is a powerful tool for cleaning up commit history before pushing changes. It allows you to reorder, squash, edit, or remove commits.

Details

Interactive rebase opens an editor with a list of commits and commands:

1git rebase -i HEAD~3

Available commands:

Example workflow:

pick abc1234 Add feature X
squash def5678 Fix typo in feature X
reword ghi9012 Update documentation

This creates a cleaner history by combining related commits and improving commit messages.

References