I make new branch from master with:
git checkout -b testbranch
I make 20 commits into it.
Now I want to squash those
Based on reading several Stackoverflow questions and answers on squashing, I think this is a good one liner to squash all commits on a branch:
git reset --soft $(git merge-base master YOUR_BRANCH) && git commit -am "YOUR COMMIT MESSAGE" && git rebase -i master
This is assuming master is the base branch.