Best way from my experience is:
- When working on a new feature, make a new branch cloned from the master. Always keep the branches up to date with the master.
- After writing and committing your new features to the created branch, you test your app.
- Then merge master into the working branch, if there are new commits in the master, you may have merge-conflict. After resolving it - test again.
- If everything is working as supposed to merge your branch to the master.
That's how you can develop many new features and merge only the working ones when you need to deploy. Good luck and check this -> https://www.codeschool.com/courses/try-git