Is there a way to retrieve eclipse executed git commands?

情到浓时终转凉″ 提交于 2019-12-09 08:53:02

问题


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?


回答1:


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)"




回答2:


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




回答3:


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




回答4:


How about git reflog to view command history of git



来源:https://stackoverflow.com/questions/19048070/is-there-a-way-to-retrieve-eclipse-executed-git-commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!