JGit: Sprawdź zdalną gałąź
Używam JGit do pobrania gałęzi zdalnego śledzenia.
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();
Pliki są wyewidencjonowane, ale HEAD nie wskazuje gałęzi. Poniżej znajduje sięgit status
wydajność,
$ git status
# Not currently on any branch.
nothing to commit (working directory clean)
Ta sama operacja może być wykonana w linii poleceń git, łatwo i działa,
git checkout -t origin/mybranch
Jak to zrobić JGit?