Pushing directly to master is a bad habid. This is how you can avoid it.
On your repository's website select the tab Settings. From the left menu select Branches and then Add rule.
You name the new rule for your master branch and then check Require pull request reviews before merging & Include administrators.
Save Changes and from now on you need to create new pull requests with branches in order to merge with the master branch.
An how to do that?