Asides from doing a proper warm up there are several gardening tips you can heed to avoid getting more than a thorn in your side!
Use a gardening stool or pad for extended periods of weeding or planting. Better yet, plant as many of your plants in raised flower beds in order to avoid the need for bending much at all! No body part takes kindly to sustained positioning, so be sure to take frequent breaks in order to mix up your positioning. It is recommended to do one light task such as weeding for around 20 minutes, then switch it up to something heavier, like digging or hauling dirt for another 20. To make it easy, think about getting three types of gardening activities in each hour.
Remember common advice even when gardening. For instance, when lifting heavy items including soil bags or your wheelbarrow use your legs and not your back. Keep your back in a fairly straight position and gently pull in your tummy muscles before lifting in order to help support your torso. Your legs are strongest when they are bent only halfway so don’t squat too far before standing back up again. Keep the load close into your body and don’t twist while lifting or setting items down; move your feet to get the item there. Twisting can also be a culprit causing injury even when weeding or doing light tasks; try to turn your feet and or hips as often as possible to complete your tasks in order to avoid unnecessary stresses on your back.