Preventing gestational diabetes

If I diet and exercise during my pregnancy, will I avoid this? Some women says it’s inevitable and it just happens.... 😫