If you ride off-road its almost inevitable that at some stage you'll damage your rear derailleur. Bending it back into shape can be a little tricky. I have used the approach outlined below with good results:
Step 1
Remove the inner plate and jockey wheels. Check whether the jockey wheels are damaged. Replace as necessary.
Step 2
Check alignment of inner plate using a straight edge. Straighten as needed.
Step 3
Remove the outer plate by removing the cage screw. Note the orientation of the cage spring etc. to make reassembly easier.
Clamp top jockey wheel bolt hole in vice and insert a suitable rod where the cage screw. In this case, a 12mm drill is perfect for this XTR rear derailleur.
Use the drill to check the alignment of the pivot with the top jockey hole. Using the drill as a lever, bend as necessary to get things square.
Use a square and the edge of the vice jaws to check alignment of the bottom jockey wheel bolt hole in the cage. Use a set of multigrips or a shifter to twist and bend the lower part of the cage as necessary.
The threads on the jockey wheel bolt holes may need a little clean up after being clamping in the vice and bent around.
Step 4
Reassemble and you're done.