Here our aim is to focus on the second definition of the geodesic (path of longer Proper Time) to derive the Geodesic Equation from a variationnal approach, using the Principle of least Action. That's actually how Einstein deduced it in his 1916 synthetic paper The Foundation of the General Relativity of Relativity
We can express the proper time along a time-like wordline (while ignoring the limits) as:
with λ being the affine parameter parametrizing the path.
For a given proper spacetime interval ds2 = gμνdxμdxν, we get:
But according to the calculus of variations, finding the path with maximal proper time is equivalent to find the path with extremal action (in this case a maximum), with the action S and the integrated Lagrangian L defined as:
where the dot over the x denotes the derivative with respect to λ.
Passing the above Lagrangian through the Euler-Lagrange equation gives:
For the four-dimensional space-time, as the indice α can take four values, this equation represent four differential equations.
Looking at the first member and remembering that the metric only depends on xα (and not on the dot/derivatives coordinates), we get using the usual derivative rules
We can now remark that from the above definition of τ, we can write dτ as:
Applying the chain rule we finally obtain
Similarly, considering the second term δL/δxα of the Euler-Lagrange equation:
Putting all the terms together, our initial Euler-Lagrange equation becomes:
Finally, multiplying both sides by dλ/dτ gives:
We get the geodesic equation in its most common form, which is more simple to use than its alternative form with the Christoffel symbol as in this case the metric tensor gαβ get referenced directly.
For the sake of it, let us make sure that the two expressions are equivalent.
First let us develop the first term of the above equation
Injecting this expression in our original Euler-Lagrange expression gives:
Multiplying now by the inverse metric gγα we get
As μ and ν are interchangeable indices, one can write:
We then confirm that the two expressions of the geodesic equation are strictly equivalent.
 The path taken by the system between times t1 and t2 is the one for which the action is stationary (no change) to first order, which means δS=0.