I am trying to use jGit to clone a repository and checkout a particular commit.
Assuming the commit hash is: 1e9ae842ca94f326215358917c620ac407323c81.
My first step is:
// Cloning the repository
Git.cloneRepository()
.setURI(remotePath)
.setDirectory(localPath)
.call();
I then found another question which suggested this approach:
git.checkout().
setCreateBranch(true).
setName("branchName").
setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).
setStartPoint("origin/" + branchName).
call();
But I'm unsure how to link the two together?
Any thoughts?