# Created on savesnippets.com · https://savesnippets.com/TDE4e4p6pohzV1 # Interactive — let you pick which commits to squash and write a fresh message git rebase -i HEAD~5 # Non-interactive: reset to N commits back, leaving changes staged, # then commit with a clean message git reset --soft HEAD~5 git commit -m "feat: complete user onboarding flow" # Force-push to update the remote branch (only for YOUR feature branch — never main) git push --force-with-lease # safer than --force, refuses if remote moved