Class LogCommand

All Implemented Interfaces:
Callable<Iterable<RevCommit>>

public class LogCommand extends GitCommand<Iterable<RevCommit>>
A class used to execute a Log command. It has setters for all supported options and arguments of this command and a call() method to finally execute the command. Each instance of this class should only be used for one invocation of the command (means: one call to call())

Examples (git is a Git instance):

Get newest 10 commits, starting from the current branch:

 ObjectId head = repository.resolve(Constants.HEAD);

 Iterable<RevCommit> commits = git.log().add(head).setMaxCount(10).call();
 

Get commits only for a specific file:

 git.log().add(head).addPath("dir/filename.txt").call();
 

See Also: