Issue
I'm a regular git user, and I'm building some shortcuts in eclipse to activate some EGit functions.
I'm a bit wary of what is EGit doing (especially the synchronize workspace
operations), and I was wondering if I could make EGit show what git commands it was using.
Do you know of an option to make it log to the console, or generally, how to find out which commands got executed?
Solution
EGit does not use the git executables. It reproduces, with the help of JGit, what the executables would do.
Git executables store the versioning state of a project in a number of files under the .git folder (branches, refs, commit objects, tags and so on).
EGit and JGit do the same.
For example:
A commit with git executables:
git commit -m "My commit message"
Would be executed in Java through EGit with CommitOperation.commit(), which uses JGit's CommitCommand.call(), which builds and inserts a commit object, which are representend through files.
There is no clear mapping between EGit's UI operations and their meaning as regular git commands, at least not to my knowledge.
One can go through (EGit, JGit, git)'s code and look for what is happening under the hood, though.
EDIT: a pgm package in JGit provides the inverse mapping: "Command-line interface Git commands implemented using JGit ("pgm" stands for program)"
EDIT: A not-merged Eclipse patch exists for logging what Egit does under the hood: https://git.eclipse.org/r/#/c/103342/
Answered By - BenoitParis
Answer Checked By - Marilyn (JavaFixing Volunteer)