A 10 minute brisk walk and stretches for the spine and limbs are good ways to warm up.
Be aware of how your body feels as you work in your garden. If a part of your body starts to ache, take a break, stretch that body part in the opposite direction it was in, or switch to a different gardening activity. For example, if you've been leaning forward for more than a few minutes, and your back starts to ache, slowly stand up, and gently lean backwards a few times.
Lift with your knees and use good posture while moving a cart or wheelbarrow.
Use knee pads or a gardening pad. If kneeling or leaning down to the ground causes significant pain in your back or knees, consider using elevated planters to do your gardening. If kneeling on both knees causes discomfort in your back, try kneeling on one and keep the other foot on the ground.
Use good body mechanics when you pick something up or pull on something, such as a weed. Bend your knees, tighten your abdominals, and keep your back straight as you lift or pull things. Avoid twisting your spine or knees when moving things to the side; instead, move your feet or pivot on your toes to turn your full body as one unit.
If you haven't done gardening or other yard work in a while, plan to work in short stints, building in time for breaks before you start feeling aches and pains.
End your gardening session with some gentle backward bending of your low back, a short walk and light stretching, similar to stretches done before starting.