First-mashing is a waste of muscle (my opinion)
Second-weights, resistance training, squats what ever excercise that works for you- build your legs!!
Third- no shame in the snake!!! the last technique we use (hubby, brother and some friends) before we decide to dismount the bike on steep inclines. the snake is going back and forth across the road in the pattern a snake would use to gain a little speed and rest the legs.

We ride our bikes in the White Mountains of Maine and have found a few good techniques.

1st- lightweight bikes lots of gears!! Downshift as you need comfort -no mashing. As someone else mentioned shift up a few and stand for a bit, when you sit shift down as you need. Try to keep a bit in reserve. You can use this a few times on steep hills.

2nd- spin up sitting up in control without losing momentum straight not bouncing in your seat!

3rd- the snake!!! It is less shame than walking!!

It all works for me.