I am looking for a way to put an end to "holy wars" about "the only right code formatting for all people". Currently, most companies have its own code-style (expressed as, for example, .clang-format
), but obviously people have different mindsets/tastes/views on how the ideal formatting should look like.
My idea is based upon the fact that it is only important to push my code in central repo in the format of a company, while nobody prevents me from having and working with code that is formatted in my own way.
My question
Are there any tools (or a description of a workflow) that would allow me to have two differently formatted versions of source-code?
I suppose there should be something about scripts/local hooks and two git repos (one for officially formatted code, and one for my version)? Or alternatively, it might be possible to have just one repo and reformat the code on commit, but disadvantage of the approach is that IDE's diff will not work (well, it will, but it will show huge code diffs all the time).