Start an interactive rebase
Run `git rebase -i HEAD~N` where N is the number of commits back you want to edit. Git opens your editor with a list of those commits, oldest at the top.
# Rebase the last 4 commits interactively
git rebase -i HEAD~4
# Rebase all commits since branching from main
git rebase -i main
# Rebase from a specific commit (exclusive — that commit is not included)
git rebase -i a3b2c1d
# The editor opens with something like:
# pick f7a1b2c WIP: user auth
# pick 3d9e4f5 fix
# pick a1c2d3e fix again
# pick 8b7e6f4 Add user authentication moduleThe list shows oldest commit at top, newest at bottom. This is the opposite of `git log`, which shows newest first. The rebase replays commits top to bottom.

