@Robert To me the most natural way to do it would be to homotope $g_1 \circ f_1$ to $g_1 \circ f_2$ by $g_1 \circ F$ and then homotope $g_1 \circ f_2$ to $g_2 \circ f_2$ by $G \circ f_2$.
@BalarkaSen, that's the one I've seen before. When I tried it before looking at the solution, I came up with the above, so to me it seems "most natural".