Git squash is used to squash previous multiple commits into one, where we can merge several commits into a single commit with the compelling interactive rebase command. It allows developer to simplify the Git tree by merging sequential commit into one another.  We have an option to squash using IDE as well such as IntelliJ, Eclipse where it has integrated support for Git operation and allows us to squash commit from GUI.  To squash the last n commits into a single commit using Git, we can use the below:  Note: Squash is not command, it’s Git operation.  Git rebase – i HEAD ~n
E.g.- Git rebase – i HEAD~10
Git commit  Here just to note we have few drawbacks as well for squashing commits, and rebasing changes in the history of the repository.   One of the issues could be if updated history is not checked, then it may lead to conflict. To avoid same, it is suggested to clean history.  There is another drawback i.e., we can lose granularity of commits because of squashing.