Don't try to change gears while going uphill and exerting lots of pressure to the pedals. You can change gears but take a very short pause or ease up on the pedaling stroke while changing gears. If possible, maybe go across the hill, easing up on the pedal stroke, change gears and continue up the hill. After a while, you'll get a "feel" for when you can or cannot change gears while pedaling uphill.