I\'m using JGit to checkout a remote tracking branch.
Git binrepository = cloneCmd.call()
CheckoutCommand checkoutC
you also can just like this
git.checkout().setName(remoteBranch).setForce(true).call();
logger.info("Checkout to remote branch:" + remoteBranch);
git.branchCreate()
.setName(branchName)
.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM)
.setStartPoint(remoteBranch)
.setForce(true)
.call();
logger.info("create new locale branch:" + branchName + "set_upstream with:" + remoteBranch);
git.checkout().setName(branchName).setForce(true).call();
logger.info("Checkout to locale branch:" + branchName);