It used to be possible to realign a bent derailleur hanger with a second wheel. This is no longer possible with today's axle standards. Insert a sturdy Allen key into the screw of the rear derailleur. This prevents the bending forces from being transmitted directly via the rear derailleur. You can now make a makeshift adjustment to the derailleur hanger.
Many current derailleur hangers are too hard to bend and are more likely to break off. In this case, the only remedy is a replacement derailleur hanger. On multi-day tours you should always have a suitable one in your rucksack. On X-12 thru axles, the bolt has a predetermined breaking point. Some manufacturers hide a spare bolt somewhere on the frame.
You can read this article or the entire BIKE 4/2015 issue in the BIKE app (iTunes and Google Play) or buy the issue in the DK shop reorder:

Editor