I'm able to push all local commits to a remote (bare repository) using JGit.
RefSpec spec = new RefSpec("master:master");
Iterable<PushResult> resultIterable = git.push().setRemote("origin").setRefSpecs(spec).call();
Now I want to push changes till a particular commit. Below is the git shell command and I need the equivalent JGit implementation.
git push <remotename> <commit SHA>:<remotebranchname>