I would instead try to make it really easy for everyone in the team to apply automatic code formatting directly inside your editor or IDE, to the source code file (or selected parts of it) they are working on. This gives your team members more control about how and when the formatting takes place, let them inspect the code before it is commited in the final form, and test it after the formatting took place, not before.
If all or most of your team members use the same editor, this should not be too hard. If everyone uses a different one, then your approach might be the second best solution, as long as the team supports this, and you have a formatter at hand where you are 100% sure it does not break anything.