I'm afraid you will have to clone the entire repository with all its branches in order to find out the newest branch.
The list LsRemoteCommandcontains the names of the branches and the identifier of the commits that they point to, but not the commit timestamp.
Git " " , , . : Git/JGit /API, , .
, ( ), , , .
, , , :
Git git = Git.cloneRepository().setURI( ... ).setNoCheckout( true ).setCloneAllBranches( true ).call();
List<Ref> branches = git.branchList().setListMode( ListMode.REMOTE ).call();
try( RevWalk walk = new RevWalk( git.getRepository() ) ) {
for( Ref branch : branches ) {
RevCommit commit = walk.parseCommit( branch.getObjectId() );
System.out.println( "Time committed: " + commit.getCommitterIdent().getWhen() );
System.out.println( "Time authored: " + commit.getAuthorIdent().getWhen() );
}
}
, , .