These pictures are from a job I did to cut a gate where there wasn't one, but I followed essentially the same process that is outlined below:
First, measure the exact hole that the gate will fit into. Lay the palings on saw horses on a very flat surface. Cut one lengthwise to make the gate wide enough if neccessary. Then match the dimensions of the cross pieces (distance from top and bottom) to the rest of the fence. Cut and screw the top and bottom cross pieces. Screw together using 1 1/4" external wood screws so the screw tips don't come out the front. Put a piece of tape around the drill bit to know when to stop drilling the holes so there are no holes in front. Also, the drill bit should be the size of the screw shaft without the threads.
Next, determine the angles at both ends of the middle cross piece. To do this, place the piece on top of the bottom and top cross pieces diagonally where you want it to go, then make small marks with a pencil underneath the board in two places at both the top and bottom. Then remove the piece, turn it over and connect the dots to make lines showing you the angle. When you cut this, sight along the blade making sure the very edge of the circular blade follows your line exactly. Then put the diagonal in place and screw it on.
Once you have rebuilt your gate, Follow the procedure on this page to rehang it.