  We generalize the theory of gradient flows of semi-convex functions on
CAT(0)-spaces, developed by Mayer and Ambrosio--Gigli--Savar\'e, to
CAT(1)-spaces. The key tool is the so-called "commutativity" representing a
Riemannian nature of the space, and all results hold true also for metric
spaces satisfying the commutativity with semi-convex squared distance
functions. Our approach combining the semi-convexity of the squared distance
function with a Riemannian property of the space seems to be of independent
interest, and can be compared with Savar\'e's work on the local angle condition
under lower curvature bounds. Applications include the convergence of the
discrete variational scheme to a unique gradient curve, the contraction
property and the evolution variational inequality of the gradient flow, and a
Trotter--Kato product formula for pairs of semi-convex functions.
