Lean Against The Slope
You hear all sorts of advice about playing from hilly lies, but what it all comes down to is this: keep your balance. Do whatever you have to to avoid falling forward, back away from, and into the ball.
Balance has always been one of the keys to my swing. People often wonder how I can take my rather narrow stance, swing as hard as I do, and not sway or topple off the ball. I think the reason is that I've been blessed with good balance. I grew up doing a lot of waterskiing and surfing. I've done loops in fighter planes and been on hundreds of fishing boats in all sorts of seas, yet I've never had motion sickness.
But when I get a hilly lie, even I have to pay extra attention to what I'm doing. The basic idea is to make sure your weight at address is leaning against the slope. On an uphill lie, put a bit more weight on your left side - flex your left knee a little more if that helps. Don't change your ball position or anything else. Just lean into the upslope a bit. This will counteract a tendency to fall backward off the ball as you take the club away.
When you're hitting the ball off a downhill slope, shade extra weight onto your right foot - flex your right knee a bit more if it helps to give you that sense of balance. From either of these lies, do yourself a favor and take a practice swing. This dry run will probably remind you of the other important key when playing from hilly lies - keep your swing compact and controlled.