Is it possible that the solution is to look at why there is such a high frequency of commits by different devs into the same main branch?
Rather than look for a technical solution I would explore process and culture changes, such as having the various devs making all the different commits start pairing.