[Git] Squash commits

git checkout yourBranch
git reset --soft HEAD~$(git rev-list --count HEAD ^master)
git add -A
git commit -m "one commit on yourBranch"
原文地址:https://www.cnblogs.com/Answer1215/p/15359635.html