首页 » Software Engineering » 正文

How to squash many commits into one commit in SourceTree

Suppose we already merged from remote masterbranch.

Select the remote master node, and right click.

Then Click Reset xxxx(your branch name) to this commit.

Choose Soft – keep all local changes, and Click OK button

Now you will find all your changes are uncommitted

Type your commit message and click Commit button.

Click push button and check Force push option

Done

You need to check Allow force push option in Sourcetree Preferencesif you cannot find it.

Thanks forFanglin’s help.

Reference:

https://sqbu-github.cisco.com/WebExSquared/wx2-ios-client/wiki/How-to-squash-many-commits-into-one-commit-even-you-have-merged-other-developer-commits