Editor's Note: This post is courtesy of Art's Cyclery. The original posts can be found here.
So you are out on your bike and your rear derailleur cable snaps. What now? Here's a quick roadside fix that you can use to get me home.
The first thing you'll want to do is release all the shifts from the rear derailleur. Be sure to pull on the cable as you do this so the cable doesn't bind up inside of the shifter and lock the shifting mechanism in place.
Once all the shifts are released, remove the cable from the shifter. After the cable is removed, remove the other broken part of the cable from the rear derailleur. At this point, you will also need to remove the last section of housing from the derailleur or cable stop. Once that section of cable and housing is removed, grab the section of cable with the head on and pass it through the barrel adjuster or housing stop on the rear derailleur until the head of the cable stops. Watch this video to see the full process.
Next, you'll want to select a gear that you think will be able to get you home comfortably, probably somewhere near the middle of the cassette. Once you are in the gear that you want, simply anchor the cable onto the derailleur with the cable fixing bolt. Once it's in the gear of choice, you can use the barrel adjuster to fine tune the derailleur in that gear to eliminate noise and keep the chain from skipping around between gears. Loop whatever is left of the cable somewhere out of the way in order to keep it from getting wound up in the wheel or rear derailleur and you're good to go.
If the cable breaks off at the head and there isn't enough length to put through the derailleur and anchor in place, you can either tie a knot in the cable to accomplish the same thing, or use the limit screws on your rear derailleur in order to get your bike into a more manageable gear.