title: Looping over commits for a file with jGit
body: <p>I've managed to get to grips with the basics of jGit file in terms of connecting to a repos and adding, commiting, and even looping of the commit messages for the files.</p>
  
  <pre><code>File gitDir = new File("/Users/myname/Sites/helloworld/.git");
  
  RepositoryBuilder builder = new RepositoryBuilder();
  Repository repository;
  repository = builder.setGitDir(gitDir).readEnvironment()
          .findGitDir().build();
  
  Git git = new Git(repository);
  RevWalk walk = new RevWalk(repository);
  RevCommit commit = null;
  
  // Add all files
  // AddCommand add = git.add();
  // add.addFilepattern(".").call();
  
  // Commit them
  // CommitCommand commit = git.commit();
  // commit.setMessage("Commiting from java").call();
  
  Iterable&lt;RevCommit&gt; logs = git.log().call();
  Iterator&lt;RevCommit&gt; i = logs.iterator();
  
  while (i.hasNext()) {
      commit = walk.parseCommit( i.next() );
      System.out.println( commit.getFullMessage() );
  
  }
  </code></pre>
  
  <p>What I want to do next is be able to get all the commit message for a single file and then be able revert the single file back to a specific reference/point in time. </p>