Over a million developers have joined DZone.

A New Java Library: ParallelGit

DZone's Guide to

A New Java Library: ParallelGit

DZone user Junyi Bei showcases a new open source library called ParallelGit, to help manipulate your local Git repository.

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

Hi all. Just published an open source library to the Maven Central Repository. As the author of this project, I am here to shout out the exciting news :)

ParallelGit is a library to help you manipulate your local Git repository. It allows you to access your repository as it were a native file system (via Java 7 nio FileSystem interface).

public void copyFileToRepository() {
  Repository myRepo = RepositoryUtils.openRepository(new File("/home/repository"));
  try(GitFileSystem master = GitFileSystemBuilder.forRevision("master", myRepo))) {
    Path fileInRepo = master.getPath("/myFile.txt");
    Files.copy(Paths.get("/home/myFile.txt"), fileInRepo);
    Requests.commit(master).message("copied myFile.txt").execute();

For more information and examples, please visit Github/ParallelGit and its official site.

Thank you for your attention!

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

java ,git ,jgit ,github ,nio ,filesystem ,java 7 ,java 1.7 ,fs

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}