Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i run git commands from java?

Tags:

java

git

I was able to run the git commands via shell script. But is there any possible mean by which I can call each git statement i.e git show <SHA>:<file> directly from java ?

like image 734
Developer Avatar asked Mar 05 '17 02:03

Developer


People also ask

Can you use Git with Java?

If you want to use Git from within a Java program, there is a fully featured Git library called JGit. JGit is a relatively full-featured implementation of Git written natively in Java, and is widely used in the Java community.

Where do I run Git commands in Eclipse?

Use Ctrl+3 (or Cmd+3) and type Git Repositories in the dialog to open the Git repositories view. This view shows you the Git repositories you can work with in Eclipse and allows you to add existing repositories to Eclipse, create or clone repositories. It also allows you to perform Git operations.

Do we need Java for Git?

You must have Java, Eclipse, Constellation, and Git set up and working on your laptop.


1 Answers

You can use the Process API to execute git commands directly.

Or, you could use JGit, which is a Java implementation of git.

like image 127
Jeremy Avatar answered Oct 12 '22 13:10

Jeremy