JGit: Checkout una rama remota
Estoy usando JGit para pagar una rama de seguimiento remoto.
Git binrepository = cloneCmd.call()
CheckoutCommand checkoutCmd = binrepository.checkout();
checkoutCmd.setName( "origin/" + branchName);
checkoutCmd.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK );
checkoutCmd.setStartPoint( "origin/" + branchName );
Ref ref = checkoutCmd.call();
Los archivos están desprotegidos, pero HEAD no apunta a la rama. Siguiente es elgit status
salida,
$ git status
# Not currently on any branch.
nothing to commit (working directory clean)
La misma operación se puede realizar en la línea de comandos git, fácilmente y funciona,
git checkout -t origin/mybranch
¿Cómo hacer esto JGit?