git rebase -i --autosquash HEAD~n

Interactively rebase with autosquash for last n commits.

This command starts an interactive rebase for the last n commits, where n is a placeholder for an integer (e.g., HEAD~3).

During the interactive rebase, commits marked for autosquashing (i.e., commits prefixed with fixup! or squash!) will be moved to the correct changeset and combined automatically. The command achieves this by combining -i (interactive) and --autosquash flags.

Alternative variants may include omitting the --autosquash flag for a standard interactive rebase (git rebase -i HEAD~n) or using git rebase -i --autosquash <commit> for rebasing up to a specific commit.

Sign in to enable bookmarking, reminders, progress-tracking and more...