Good grief, the tree trick is when you are on the trail and don't feel like messing with bolts.
For the bars. Mark the angle of the bars in the clamps. I use a sharpie and draw a line. Loosen all the bar clamp bolts slightly. Wiggle the bars a little. If they don't move in the clamps loosen a bit more. Set the angle back my looking at the sharpie mark. Tighten the bolts. When you are done the caps on the clamps should not touch the clamps on the triple tree. I tighten in increments so both sides are the same. A torque wrench and the factory spec is a good idea. If you don't have those things, give the bars a yank and a shove to make sure they won't move while riding after you think they are properly tightened.
For the forks. Mark the triple tree height on the forks. I use a mechanical pencil. Slightly loosen the front axle nut. Slightly loosen all of the triple tree bolts, and all of the front axle bolts. With the tire between your knees, standing in front of the bike, wiggle the handle bars. Then align them so the bars and tire are 90 degrees. Bars and fender can be bent, so pick a point that makes sense or you can live with. Make sure you have the right triple tree height, or fix it. In order, tighten the RH axle bolts. Then tighten the axle nut. Then the LH axle bolts. Check the alignment and height one more time. Now tighten the triple tree bolts. All the triple tree bolts should be tightened evenly. Way too much is bad, too little is dangerous. A torque wrench and the factory spec is a good idea.
After a hard hit I can do this whole procedure in about 5 minutes minus the torque wrench (I don't carry one). If it is 100f or the biting bugs have already caused a rider fatality I use a tree. The rest of the time I just do it right. You will need a decent 10mm, 12mm wrench. The one in the factory tool kit will destroy the bolt heads after a few uses.