First, ride up more hills. That helps you get better at riding up hills. Sounds like a circular argument, and perhaps it it, but it does work.
After climbing for a few months, try the same hill a couple times, one sitting and spinning, one standing and grinding. Come back a couple days later, do it again, only switch the standing/sitting order. What felt easier/faster/better? Do it that way, unless you want to try the other.
Most of my climbing is spinning, yet when I see a short roller, it's a lot of fun to take a run at it and see if I can summit the climb without getting bogged down. When it works, it's great!