git merge --squash code example
Example 1: git merge tag to branch and squash commits
git checkout master
git merge --squash tag
git commit
Example 2: git merge squash
git checkout master # Switches to your master branch.
git merge --squash bugfix # All grouped commits from bugfix to current branch
git commit # Creates a single commit from the merged changes