I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash all 20 commits into one commit, preferably using sourcetree? I want to do this so I can just push one commit to origin/master.
In sourcetree I have figured out to use the interactive rebase command in the repository menu. It brings up the exact list of commits I want to squash. I tried hitting the squash button repeatedly until it shows one commit containing all of them. But when I hit OK I end up with only the two most recent commits squashed. So even though the dialog seems to show it can squash multiple in practice I can't get it to work.
Easier solution (than a rebase):
Select the "origin/master" commit in the log entry, click on "Reset <branch> to this commit
".
Use the default mixed mode.
Then add and commit: all your changes will be registered again in one new commit, that you will be able to push.
See git reset
Demystified for more.