Squash all commits between a branch and master
I usually create small commits when adding new code such that I can easily revert back little by little. This is fine but creates a long and messy history. Git allows squashing commits together.
I typically create a feature branch
git checkout -b feature-branch
# do stuff
git add -a
git ...