What
Use git rebase -i to squash, reorder, reword, or drop commits from your local branch before you push.
Why
Reviewers see one commit per logical change when you squash related work together. Interactive rebase rewrites local commit IDs. Use it freely on an unpublished branch, but coordinate before rewriting a shared branch. If you already pushed the branch, update it with git push --force-with-lease rather than --force so you do not overwrite someone else's new commits.
How
git rebase -i HEAD~N
Replace N with the number of commits to edit. In the editor:
squash/s: combine with previous commitdrop/d: remove commitreword/r: edit commit messagepick/p: keep commit as-is