Reputation: 1439
I'm writing an utility in swing that show all my projects and should let me clone a specific repo and also select the branch I want to switch to, once the cloning process is finished.
The only problem is that in order to show the branches as far as I can see you need to clone the repo first.
Is there a workaround for that?
Upvotes: 1
Views: 62
Reputation: 15872
You can list tags/heads on remote repositories via the following snippet:
Collection<Ref> refs = Git.lsRemoteRepository()
.setHeads(true)
.setTags(true)
.setRemote(REMOTE_URL)
.call();
See also this ready-to-run snippet in the jgit-cookbook
Upvotes: 1