Introduction
Sometimes your git history has many small commits that clutter the log. Squashing commits means combining several commits into one to keep history clean and easier to understand.
When you have multiple small fixes that should be one logical change before sharing your work.
Before merging a feature branch into the main branch to keep history tidy.
When you want to rewrite commit messages for clarity and consistency.
If you accidentally committed work in several steps but want to present it as a single update.
When cleaning up your branch history before pushing to a shared repository.