git commit --squash HEAD~1

Category: Git - Core

git commit --squash HEAD~1

Mark a commit to squash into the previous one

Creates a commit tagged as a squash target for the named commit, usually the one just before it. During an interactive rebase, git rebase -i folds squashed commits into their target. Unlike --fixup, the squash marker keeps your message so you can edit the combined one.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.