Git Rebase Cheat Sheet/Interactive rebase last 3 commits

Edit the last 3 commits.

Section: Interactive Rebase Basics

Interactive rebase last 3 commits

bash
bash
git rebase -i HEAD~3
Explanation

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.
OpenIn sheetbashsame section
Show current patch during rebase
Inspect the patch currently being replayed.
OpenIn sheetbashsame section
Continue rebase after resolving conflicts
Resume the rebase once conflicts are fixed.
OpenIn sheetbashsame section
Abort a rebase
Cancel a rebase and return to the starting state.
OpenIn sheetbashsame section
Skip the current patch during rebase
Omit the commit currently being replayed.
OpenIn sheetbashsame section
Keep commit as-is
Todo action to replay a commit normally.
OpenIn sheettext2 tag match