Remove the rotted wood with a chisel and pry bar. The rotten wood will come away easily. Discard the wood in a garbage bin as you work to make the cleanup easier.
Measure the length of framing wood needed with a measuring tape. If the entire rafter was rotten, use the length of another rafter to get your measurement. If only part of the rafter was bad, measure the gap in the good wood.
Cut the framing wood to fit with a circular saw. Do not rush the wood through the saw; feed it slowly.
Cut sister boards if necessary with a circular saw. If only part of the rafter was rotten, you will need four boards to join the wood together. Cut four pieces out of a 2-by-4 that are each a foot in length.
Screw the new rafter into place. If you are replacing the entire rafter, screw down into the wood through the top and bottom joists. If replacing part of the rafter, attach one end of each sister board through the existing rafter. Fit the rafter into place between the boards and screw through the sister boards into the rafter. Repeat with the other side.
Seal the wood with a waterproof wood sealant to prevent future damage. Paint the sealant on with a paintbrush.