D
DevCompendium
Prompts
Commands
Collections
Flows
Library
Commands
Interactive Rebase Last N Commits
Git
GitHub
bash
Interactive Rebase Last N Commits
Squash, reorder, or edit the last N commits interactively
Mikkel
0 forks
0 saves
Updated Dec 30, 2025
Fork
Save to Library
Command
Fork Tree
0
Command
$
git rebase -i HEAD~{{n}}
Useful Notes
Use 'squash' or 's' to combine commits with the previous one
Use 'reword' or 'r' to change commit messages
If you make a mistake, use 'git rebase --abort' to cancel
Tags
Git
macOS
Linux
Windows