While working on a feature branch of my own, I usually push commits frequently. This way, rolling back on a buggy commit is really easy and less work is lost.
But, before I merge into master or a staging branch, I usually squash these smaller commits into larger ones that semantically makes sense before merging, just to avoid too many commits in the commit history for master.