Edit the last 3 commits.
Section: Interactive Rebase Basics
Interactive rebase last 3 commits
bash
bash
git rebase -i HEAD~3Explanation
Opens the todo list so you can reorder, squash, edit, or drop commits.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Interactive Rebase Basics
Edit rebase todo during a rebase
Open the rebase todo list while a rebase is in progress.
Show current patch during rebase
Inspect the patch currently being replayed.
Continue rebase after resolving conflicts
Resume the rebase once conflicts are fixed.
Skip the current patch during rebase
Omit the commit currently being replayed.