Squashing a pull request
This article is over 2 years old. Proceed with caution.
Regards ♨ – Minimul
I was asked to squash all of the commits of a recent pull request (PR).
- The branch I sent in a PR for is called
- Make sure to grab any new commits to the repository you are sending in the PR to.
- Interactive rebase.
- Change 'pick' to 'squash' for all commits except the first.
- Save and exit out of your editor.
- Next, git will prompt you for a commit message.
- Save and exit editor.
- Force a git push.
- Done. Your PR has been squashed to a single commit.
$ git branch -a master * pre-processing remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/pre-processing
$ git remote add upstream email@example.com:yeoman/generator-chrome-extension.git $ git fetch upstream master
$ git rebase -i upstream/master # or just 'git rebase -i master'
$ git push origin pre-processing -f