As commented by Sameer, you will have to get familiar with how Git works, see the Pro Git book.
To your list of questions, there are not always direct equivalents because the concepts are different. Hints to some of the questions:
Open a repository
File workTree = new File("/path/to/git-repository");
Repository repository = new FileRepositoryBuilder().setWorkTree(workTree).build();
Export a project/file by a given revision number
See How to “cat” a file in JGit? .
Get the latest revision of repository/project/file
Git git = new Git(repository);
ObjectId head = repository.resolve(Constants.HEAD);
// All commits, use setMaxCount(1) for newest, use addPath for filtering to path
Iterable<RevCommit> commits = git.log().add(head).call();
Fetch updates
Use the FetchCommand
(using git.fetch()
) or PullCommand
, depending on what you want, see API documentation of Git and navigate to the commands there.