4

Is there any way to retrieve git information programmatically using Java? I would like to know:

  1. All branches in current repository-directory
  2. Current branch of my working project
  3. All committed informations

In addition can I execute git processes (commit, rollback, checkout, delete branch, etc.) using Java?

I really do appreciate any suggestions .. Thanks

Cataclysm
  • 7,592
  • 21
  • 74
  • 123

2 Answers2

4

JGit http://eclipse.org/jgit/ is a Java API for interacting with a Git repository. I believe it is the basis of EGit which is the plug-in that integrates Eclipse to Git.

Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
3

I think you can make use of shell commands within Java. Try to run a simple shell command withing Java. Then you can add more git specific commands within your program.

http://www.mkyong.com/java/how-to-execute-shell-command-from-java/

working
  • 873
  • 3
  • 11
  • 21