It's not your fault, you cannot stop it happening. Thin healthy 'perfect' people get GD, it's not a sign that you're doing anything wrong so stop blaming yourself!
I got it when pregnant with DD 7 years ago. I adjusted my diet to low GI, added in exercise, test8 g my sugar levels 4 times a day.
I did end up on insulin but that's because my first thing in the morning levels were high, nothing to do with what I had eaten, just my bodies fasting glucose level.
I was induced at 37.5 weeks as DD was a bit big, induction was fine, took 24 hrs for contractions to start after pessary, but then a nice quick Labour with gas n air. DD was born at 6.30pm at 8lb 11oz and we went home at 8am the next morning.
If you have Gd you should be referred to diabetic nurse who will give you a testing kit and instructions on diet and exercise.
General message is reduce but don't cut out carbs, try for complex rather than simple carbs (seeded bread not white) and make sure you have plenty of protein and fat. Ideally pair carbs with protein/fat so apple slices with peanut butter, toast with egg.....
DD is perfect and I tested negative for diabetes 6 weeks after she was born because once the placenta is gone the GD is gone.