A while back I was looking for an embeddable distributed version control system in Java,
and I think I have found it in JGit, which is a pure Java implementation of git.
How
There is some info at JGit Tutorial (but that also is neither really helpful nor complete and probably outdated since they switched to eclipse where no documentation is available yet).