Squash commits in Git
n Git, squashing commits means combining multiple commits into a single one. For example, if we are working on a separate feature branch, there may be a large number of commits depending on the duration of work. Once it is completed, we need to merge it to the main branch. If we decide to squash before merging, all those individual commits from the feature branch will be combined into a single commit. Hence the main commit history shows a single commit.
Squashing is used to condense a large number of commits into small meaningful commits so that we can make the git history clearer.