I preface my answer with the details that I am running on GitHub and Jenkins.
Why should a developer have to run all tests locally before committing. Especially in the Git paradigm that is not a requirement. What if, for instance, it takes 15-30 minutes to run all of the tests. Do you really want your developers or you personally sitting around waiting for the tests to run locally before your commit and push your changes?
Our process usually goes like this:
- Make changes in local branch.
- Run any new tests that you have created.
- Commit changes to local branch.
- Push local changes remotely to GitHub and create pull request.
- Have build process pick up changes and run unit tests.
- If tests fail, then fix them in local branch and push them locally.
- Get changes code reviewed in pull request.
- After approval and all checks have passed, push to master.
- Rerun all unit tests.
- Push artifact to repository.
- Push changes to an environment (ie DEV, QA) and run any integration/functional tests that rely on a full environment.
- If you have a cloud then you can push your changes to a new node and only after all environment tests pass reroute the VIP to the new node(s)
- Repeat 11 until you have pushed through all pre-prod environments.
- If you are practicing continuous deployment then push your changes all the way to PROD if all testing, checks, etc pass.
My point is that it is not a good use of a developers time to run tests locally impeding their progress when you can off-load that work onto a Continuous Integration server and be notified of issues that you need to fix later. Also, some tests simply can't be run until you commit them and deploy the artifact to an environment. If an environment is broken because you don't have a cloud and maybe you only have one server, then fix it locally and push the changes quickly to stabilize the environment.
You can run tests locally if you have to, but this should not be the norm.
As to the multiple developer issue, open source projects have been dealing with that for a long time now. They use forks in GitHub to allow contributors the chance to suggest new fixes and functionality, but this is not really that different from a developer on the team creating a local branch, pushing it remotely, and getting team buy-in via code review before pushing. If someone pushes changes that break your changes then you try to fix them yourself first and then ask for their help. You should be following the principle of "merging early and often" as well as merging in updates from master to your branch periodically.