Squash git commits from topic branch <p>I have a topic branch (macaroni), and I have submitted a pull request. I had to make a change after feedback. It was requested that I squash the two commits into a single commit. This is what I have done:</p> <pre><code>git status On branch macaroni git log commit def feedback fixes commit abc fix cheddar flavor git rebase -i origin/master .. go through screen where I pick commit to squash .. .. go through screen where I update commit message .. git log commit abc fix cheddar flavor, squashing done! </code></pre> <p>at this point I believe I have to push my topic branch using the -force flag, because I have changed history:</p> <pre><code>git push -f </code></pre> <p>I am using the second answer from this question:</p> <p><a href="http://stackoverflow.com/questions/7947322/preferred-github-workflow-for-updating-a-pull-request-after-code-review">Preferred Github workflow for updating a pull request after code review</a></p> <p>with subtitle "Optional - Cleaning commit history". The author mentions at the end that you should be using topic branches, not sure if I should have changed any of the commands since I'm already on a topic branch.</p> <p>I am also concerned with accidentally force-pushing something onto the master branch with the above since I'm using -f, but since I'm on the topic branch, only that branch should be affected, right?</p> <p>Thanks</p>