16

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?

Franz Ebner
  • 4,951
  • 3
  • 39
  • 57
BenoitParis
  • 3,166
  • 4
  • 29
  • 56

4 Answers4

10

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/

BenoitParis
  • 3,166
  • 4
  • 29
  • 56
  • As I have written an answer to my own question, @Franz-Ebner, please let me know if it satisfies the bounty you have set. – BenoitParis Aug 27 '14 at 13:13
3

Please go to .git folder of your project. There will be a log folder like in my case (D:\Repo\GIT.git\logs)

all git command executed by eclipse are logged in respective branch file.

a sample of log is

0000000000000000000000000000000000000000 27f2e02544d389eb2412c1d467cc99f1786cd662 fanishshukla 1409137288 +0530 commit (initial): First Draft for Jboss 27f2e02544d389eb2412c1d467cc99f1786cd662 6d5634200cfdf6adf7c00ae70004326d2741e3a2 fanishshukla 1409557422 +0530 commit: fast response 6d5634200cfdf6adf7c00ae70004326d2741e3a2 32dbcfa55452b1a89861f422cfc7f90d26435d8c fanishshukla 1409557443 +0530 commit: fast response

Fanish
  • 27
  • 5
2

What I found here:

There's a bug regarding this requirement:

Bug 349551 - Log EGit activities into a console
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349551

Community
  • 1
  • 1
Franz Ebner
  • 4,951
  • 3
  • 39
  • 57
  • 1
    It's worth noting that EGit does not actually run regular `git` commands but has its own implementation. Any log that EGit will emit in the future is an approximation of corresponding commands for regular `git`. – Mikko Rantalainen Aug 27 '14 at 06:57
  • Though I found the wanted answer, I'm willing to reward any further research. So if you could describe that a bit clearer and probably offer an example, the bounty is yours! – Franz Ebner Aug 27 '14 at 12:58
0

How about git reflog to view command history of git

Nam G VU
  • 33,193
  • 69
  • 233
  • 372