How to get git informations with Java?

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?

  • Keeping track of external git repos merged through `git subtree`
  • Repo sync hangs
  • Drawables won't push to github Android Studio
  • Temporarily lock a git repository
  • libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit
  • git p4 submit: patch does not apply
  • I really do appreciate any suggestions .. Thanks

  • Differences between “git pull” commands when pulling from origin?
  • Bitbucket teams/organizations?
  • unable to import with git-p4 on windows
  • Getting started with hg quickly for a git user
  • git init template, replacing modified hooks
  • Git: need to recursively 'git rm' the contents of all bin and obj folders
  • 2 Solutions collect form web for “How to get git informations with Java?”

    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.

    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.

    Git Baby is a git and github fan, let's start git clone.