Step 1: First, switch to your master branch
$ git checkout master
Step 2: Now, take all the commits from the bugfix branch and merges it with your current branch
$ git merge --squash bugfix
Step 3: Create a single commit from the merged changes
$ git commit
You must be wondering there should be an -m parameter, well omitting the -m parameter lets you modify a draft commit message containing every message from your squashed commits before finalizing your commit.