I have been working with Git from the command-line for a few weeks. I am now on a project that uses Eclipse as the IDE and EGit for the Git plugin. I am worried that by installing EGit I'm going to destroy any Git configs in my existing projects (that I've been maintaining/coding directly from a terminal).
If EGit could interfere, how so (and how can I avoid this)? If not, why?
No, it doesnt interfere. EGit only works within Eclipse and is independent from a command line Git installation. Regarding the configuration EGit of course reads your existing gitconfig. But if you use a recent Git version on the command line, there shouldn't be any differences in the config.
In fact you can keep using Git on the command line for committing, pushing etc. It doesn't matter if the project is configured for EGit in Eclipse.
Related
I want to change default Eclipse Git executable location with SourceTree installed embedded Git executable.
But in eclipse where is the configuration to change git path ?
Reason I am doing this is ,Source Tree has latest Git but separate installed version is not latest (As I don't have installation right and Through Source Tree I can update Embedded version easily).
Eclipse uses EGit which relies on JGit (a java implementation of Git).
That is why you don't see a git.exe path to set. (As opposed to SourceTree, which can use an embedded or a "system" Git)
You can only specify a Git path in order for EGit to respect your Git system config.
Eclipse has its own GIT. It relay on the EGIT project .
Source tree other other hand can use internal git or System git.
You can take the git version installed by git and try to replace it (replace the EGIT git.exe)
I recommend reading this answer by #VonC as well
Using native git not jgit in Eclipse git?
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?
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/
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
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
How about git reflog to view command history of git
Let's say I have several projects in c:\dev\ and want to keep them there (this is my eclipse workspace)
What is the least inconvenient way to setup egit?
Turns out there is a bug in egit where you cannot create a git repo on an existing folder
You need to use msysgit to create the git repo on the command line, using git init
Then you can use egit as per the user guide
I'm new to Jenkins and experimenting at the moment. I use Eclipse and run Git from within Eclipse, using the Git plugin, which is described as follows: 'Eclipse Git is an Eclipse Team provider based on JGit, a pure Java implementation of the Git version control system'.
I've installed the Git plugin for Jenkins but when I go to configure it, Jenkins complains that it can't find the Git executable. That makes sense, and the obvious solution is to install it (in my case, using a Ubuntu repository - sudo apt-get install git-core). My concern is that having two installations of Git on the machine will give rise to problems - or am I being over-cautious?
It's fine to have both - since EGit is pure Java, it has nothing to do with the installed (native code) version of Git.
Problems might arise if there was a breaking change in a future version of Git, but it should be easy enough to fix by updating both installations.
Is there a plugin for Eclipse for git-svn? I'm looking for a way to handle the SVN repo with Git (for fast branch switching etc.)
It does not look like there is a Git plugin for Eclipse that supports git-svn yet.
EGit appears to be the most active and popular Git plugin for Eclipse at the moment and it does not support git-svn, but there isn't anything stopping you from using EGit with Eclipse and interacting with git-svn via command line (or via tortoise git for example).
Eclipse bug 315264 is the EGit bug for supporting git-svn, and it looks like something that the maintainers of EGit are willing implement, but they have other priorities atm. So make sure you vote for this bug if you want the feature.
EGit is the only Git plugin for Eclipse at the moment. It doesn't support git-svn. But there is a way to make EGit work with your Subversion repository and this approach works well with any other Git client.
SubGit is the server-side solution that enables Git access to your Subversion repositories as well as Subversion access to Git repositories. You may refer to SubGit documenation for more details, but in general they are quite straightforward:
$ subgit configure --layout auto $SVN_URL $GIT_REPO
# Adjust $GIT_REPO/subgit/config
# to specify your branches, tags and other settings
# Adjust $GIT_REPO/subgit/authors.txt
# to introduce svn author names to their git counterparts
# Adjust $GIT_REPO/subgit/passwd
# in case you have no SVN credentials cached on your machine
$ subgit install $GIT_REPO
$ ... translating ... a little git is gonna born right here ...
$ TRANSLATION SUCCESSFUL
After that:
You have Git repository at $GIT_REPO synchronized with SVN repository at $SVN_URL; this sync is reliably bi-directional, i.e. both SVN and Git repositories remain writable and SubGit takes care of changes from both sides.
SubGit has installed hooks into $GIT_REPO/hooks directory which are triggered on every git push to that repository.
SubGit polls SVN repository in order to fetch new revisions.
Please note that your teammates may use the same mirror for sending their changes to Subversion repository. In this case you should setup Git server, fortunately, SubGit supports virtually every Git server available at the moment:
Apache HTTP server with git-http-backend, GitLab, Gitosis, Gitolite: supported out of the box;
Atlassian Bitbucket Server: in this case you can use SVN Mirror add-on which is built on SubGit engine;
Gerrit: you'd need to install SubGit plugin for Gerrit in this case;
Disclaimer: I'm SubGit developer; SubGit is commercial software with free options for small teams, Open Source and Academic projects.
Although this question is 4 years old, I thought I would share my recently found workaround:
Open "External Tools Configurations" (right next to "Run
Configurations") and create a new "Program" configuration.
For the working directory, choose your project from the workspace.
Enter svn dcommit into the arguments textfield.
Duplicate the configuration and replace svn dcommit by svn rebase.
Now you can launch git svn dcommit and git svn rebase with two clicks.