Replace GIT_CHECKOUT_OPT macro with a function