An analysis of 4 million code repositories reveals the building blocks for a good culture and high productivity.