To reduce the number of commits in Git when rebasing/merging with another branch or sending in a pull request, you can this Git command to 'squash' the number of commits -
git rebase -i HEAD~[number_of_commits]
For example -
git rebase -i HEAD~2
This will squash/merge/rebase the latest 2 commits in the HEAD branch.