Basic question but this happens to me all the time:
working-branch
master
git merg
I generally recommend the following Git setting:
git config push.default nothing
With this, you will at least have to name the branch when you push. It won't stop you from committing to master locally, but when you realize you have, you can move those commits to a branch without affecting anyone else.