Squashing
suggest changeSquashing is the process of taking multiple commits and combining them into a single commit encapsulating all the changes from the initial commits.
Squashing and Remote Branches
Pay special attention when squashing commits on a branch that is tracking a remote branch; if you squash commits that are already on the remote, your branch and the remote branch diverge, and updating the remote takes git push -f. Be aware that this can cause issues for others tracking that remote branch, so caution should be used when force-pushing squashed commits onto public or shared repositories.
If the project is hosted on GitHub, you can enable “force push protection” on some branches, like master, by adding it to Settings - Branches - Protected Branches.
Squash Recent Commits Without Rebasing
Squashing commits during a rebase
Squashing commit during a merge
Autosquash - committing code you want to squash during a rebase