Why is the merge tool disabled in Eclipse for a EGit-managed project? - eclipse

As per the EGit User Guide, to use the merge tool, one should right-click on the resource with a merge conflict and then select Team > Merge Tool. However, when I do this, the Merge Tool option is greyed out. EGit is properly detecting the conflict and showing me both the icon and text label decorations for the file in conflict.
Any ideas?

It was disabled for me because I had some changes on my stash list.
$ git stash clear
fixed the problem for me.

It can depend on the version of EGit you are using, and on the operation that lead to the conflict.
See for instance bug 339092 which mention merge tool being not enabled in the case of a conflict after cherry-picking: only the just released EGit 0.12 would support that.

The only time (other than a bug) that the Merge Tool would be disabled is that when you are in any status other than the Conflicts one; i.e. you will only see that option enabled when the status is Conflicts. The status is shown next to the project name in most views, such as Project Explorer and Synchronize.
Make sure you have merged with desired branch, then if your merge results in conflicts, your project will enter Conflicts mode, and the Merge Tool will be enabled.

It seems to be a bug in EGit as VonC mentioned, but the fix is easy. I did it using reset branch option on the same menu that Cherry Pick option existed.
Note: git stash clear didn't help.

This happens if you tried to push changes to a remote and there were merges required from the remote. It fails with 'not FF' but also simultaneously detects the conflict. Don't ask me why it doesn't mark the whole project as conflicted at this point.
Open the Synchronize tab, right-click the project and select 'merge'. This immediately fails because of the conflicting file, and it switches on the conflict icon label for the project and enables the 'merge tool' option.
This is for EGit 4.0.3 in Eclipse Mars.

This also happens if you're in detached head state (in my case, I had checked out a remote branch and then forgotten).
Also, even after you've corrected the problem, you may have to select a different project and then reselect the one you actually want (just selecting in the package explorer view) in order for the menu to update.

Related

How can I get rid of Eclipse Git "conflict" icons after all merges are resolved?

I get the Git conflict icon in Eclipse on lots of files, even though it seems that I resolved any possible conflicts.
In Eclipse 4.5.2, in the Project view, I select a project root and do right-click -> Compare to branch origin/master. Next, we see the Team Synchronization view. Many files show a red conflict icon., but they should not.
The Git staging view, which is supposed to show conflicts, is empty. I already tried Merge; Committing the merge (nothing remains to be committed). I tried Add to Index from the Git Staging view; and even Overwrite from the Team Synchronization view. Comparing the local and origin files shows that they are identical.
Git setting autocrlf is true, so that is not the issue.
This occurs repeatedly.
Why do I see this conflict icon? How can I get rid of it?
Did you do a pull? Or where you just comparing in Team Synchronization? In my experience the Team Synchronization perspective confuses the most people.
In general it should be used "read-only". Don't try to resolve any conflicts here. Per default you are comparing your working copy against the remote repository. Which means you actually have no conflict in your working copy. When you "fix" them here you are just making a local modification. You can commit that but it doesn't resolve any conflict. It makes the actual conflict even harder to resolve.
So don't do anything in the Team Synchronization perspective. Just do a pull to have those conflicts in your working copy and then resolve them. A merge conflict is marked as merged by moving them to the Staged Changes.
If something breaks and you want a new try do a reset --hard on the last commit in your local repository.
After editing the conflict resource properly. Right click on the conflict resource and click on *Mark as Merged".
See Resolving_a_merge_conflict. Also check this screen cast.

How to do svn up --accept mine-full in Subclipse (eclipse plugin)

I need to overwrite remote svn repo with local content.
The only tool in the environment I got is Eclipse with Subclipse.
The question is: How can I do svn up --accept mine-full in Subclipse.
Simply trying to commit results with tons of conflicts.
You just do Team > Update and when you are prompted for conflicts you choose the accept option and check the box to apply the same to all. Note there is an Update to Revision option that brings up a dialog where you can pre-set these options.
But note that update will not do anything to fix conflicts you already have in your working copy. It will just control what happens when you do the update for any new conflicts coming in.
If you have files with local conflicts, you can take the Team > Resolve option and choose one of these actions as well.
UPDATE: I did miss one thing. If you take the normal Update to HEAD option it will simply create conflicts and not prompt you to resolve. You can do it after using Team > Resolve option. However, in the preferences you can change the defaults. Go to Team > SVN > Update to HEAD in the Eclipse preferences. This will let you set it to Prompt you during update.

Eclipse Git Synchronize does not display changes

No matter what I do, Eclipse (EGit) doesn't display the changes. I've searched a lot for this issue, but cannot solve it. A friend of mine has the same issue. In the past everything worked fine, but from one day to the other the issue occured.
When I hit Team > Synchronize Workspace, only the dialog "Synchronizing Git: No changes found." appears. When I choose Team > Advanced > Synchronize, the same happens.
I also installed a new Eclipse (with a fresh Windows) and issue was still there. With my Ubuntu notebook everything is fine.
Does anybody have the same issue? Is there a solution? I also tried to install the plugins mentioned in this answer, but it didn't work for me.
Update
Eclipse also displays incoming changes (after fetching from upstream) and the changed files (with an arrow), but the synchronize view still doesn't show the changes.
Update 2 I've tested a project from Github and there everything works as apected. What could be the difference between these two projects? I've checked the repository settings and they are equal. Could the authentication cause the issues? Like I've said, the project works fine on my Ubuntu machine.
I've tried the new EGit, re-cloning the project and nothing worked except this:
In the Synchronize view, click on the dropdown arrow next to Synchronize button, then select "Synchronize...".
In the dialog that appears choose Git, press Next.
Then the crucial part - select destination to be HEAD for your repository and check "Include local uncommitted changes in comparison".
Click Finish.
I used to have the same problem but upgrading to EGit 2.2 seems to have taken care of it. Things are now consistent between "git status" at command line and "Team / Synchronize Workspace" in Eclipse.
You can get EGit from here or you can add the update site http://download.eclipse.org/egit/updates-2.2 to Eclipse.
Latest Egit Update Site:
http://download.eclipse.org/egit/updates
Before you can synchronize your workspace, you need to do a "fetch" from the remote repository (Team -> Fetch from Upstream) to get all the incoming changes into your local repository. Afterwards you can synchronize them.
If you don't want to make two clicks for synchronizing, you can enable "Always launch fetch before synchronisation" in Preferences -> Team -> Git -> Synchronize.
Staged ChangesThis has worked for me :
Whenever you made any changes. Right click on your Project name then Go to Team and click on "Add to Index". Now again Right click on your Project Name then Go to Team and click on "Commit". Now You will see that Git Staging console has been opened and the changes you have made are started displaying in Staged Changes box.
We were strugeling with the same problem. It turned out that we had to remove all options in Git->Synchronize preferences.
We are using Eclipse Juno and Kepler. Removing the options solved the problem for both.
If it helps anyone, I ran into the same problem.
During synchronization, in repository selection, the option Include local uncommitted changes in comparison is not checked and shows No changes found in the Synchronize view. Synchronizing with that option checked, shown the changes.
Eclipse Version: Luna Service Release 1 (4.4.1) - MacOS

Subclipse shows dirty decorator even though project is up to date

I have an eclipse project with which I'm using subversion and subclipse. Currently the top level folder of the project is showing the dirty decorator even though when I do a "Compare With->Latest from Repository" the response is "There are no differences between the selected inputs." Furthermore, an "svn diff " from the command line shows no differences.
Here's a transcript:
[ollie#devdataload workspace]$ svn diff DataLoadEagleOliver
Property changes on: DataLoadEagleOliver
___________________________________________________________________
Added: svn:mergeinfo
Merged /FinancialReport/trunk/Java/DataLoadEagle:r1178-1186
[ollie#devdataload workspace]$
Is this expected behavior and I'm missing something or is this a know issue with subclipse?
I'm using subclipse 1.6.18 and Eclipse Indigo. The next thing I'm going to try is upgrading subclipse to the latest version.
The svn diff does show a difference: the svn:mergeinfo property. This might not show up when you do Compare With, but it is a difference, and you should probably commit it.
That property is automatically changed whenever you merge from another branch. It keeps track of which revisions have already been merged, so it can skip them the next time you merge from the same branch.
The commit or revert options are good ways to see which paths have changes. When the change is only to a property, those dialogs will have a decorator to show this. The Eclipse compare options are focused on file content so you cannot really see property differences in those editors.

Eclipse and EGit: How to easily review changes to ALL modified files before committing to *local* repository

I'm using Eclipse Indigo SR2 with the (built-in) EGit plugin v.1.3.0.201202151440-r and haven't been able to find any way to easily review all my changes before making a commit.
I used Eclipse with SVN for years, and this was always very easy to do. I would typically right-click on my project, select Team->Synchronize, double-click on the first changed file (in the Team Sync perspective), then hit Ctrl-. repeatedly to review all changes in one file, and then proceed to the next file, as I wrote a summary of my changes for the commit message.
But of course, git is very different from Subversion, and so my workflow must change. With EGit, "Team Sync" only appears to be useful for reviewing changes between my local files and the remote repository (i.e. before a push to the remote). I need a way to review changes since my last commit to my local repository. I generally don't even care to (re)review changes before a push to remote (and if I did, I'd prefer a simple equivalent of git log to see what commits I'm about to push).
If I right-click on my project and select Team->Commit, I am presented with a window that does almost everything I need to do (select files to stage, commit, write a commit message, amend a previous commit, etc.). What it doesn't allow me to do is quickly and easily review all my changes in a compare editor. I can't believe this capability doesn't exist! It seems I am required to double-click on each individual file, review the changes, close the compare editor, and double-click on the next file. That's ridiculous!
TL/DR - I am looking for a simple GUI equivalent (in Eclipse) to do what I am easily able to do from the command line using git vimdiff (where vimdiff is a git alias that uses vimdiff as the "difftool" to cycle through all modified files) followed by git commit (with perhaps a git add or two in between).
If no one has a good solution, I am curious about how others handle their commit workflow with EGit. I've been getting along fine committing from the command line (not that Eclipse is happy about that) but I can't believe that EGit is as near-useless as it seems to me. Perhaps my google-fu is not as strong as it once was?
Says here that you can see the diffs between the working tree and any given reference. Perhaps you should try out the latest version (Juno) of Eclipse/EGit and see if it's gotten any better?
Update: I've tried this out in the latest Eclipse, and as far as I can see it works fine. Here's how:
In the moment of writing this, Eclipse Juno 4.2 is the version you should go for. On the download page, you can pick between several packages according to your needs. The 'Eclipse IDE for Java Developers' comes bundled with EGit, but you can also install EGit into any distribution using the Eclipse Marketplace (under the Help menu).
Once you've imported your project into Eclipse, make sure the project is "shared":
Right-click project -> Team -> Share Project.. -> Git
Now do the following:
Switch to the Team Synchronizing Perspective.
Click the little synchronize button in the Synchronize View.
Choose Git
Pick a suitable branch to sync against, like refs/remotes/origin/master
Make sure to check the "Include local uncommitted changes in comparison" box
Click Finish
Now, change some files and watch them appear in the Synchronize View. Double-click the changed files to see the diff (like in the screenshot below).
Are you aware of the 'Git Staging' view. It keeps track of all the files that have changed and you can review the changes any time. (This can be a bit better than using the commit dialog)
An alternative is to commit all changes without reviewing, and then use the history view to compare two commits (Simply select the last top most commits, right click and select 'Compare with each other'). This way you do not have to keep double clicking individual files. If you need to change something you can always 'Amend' the last commit. (I usually follow this approach)
I am writing this as of Eclipse Oxygen, but it should apply to other versions as well.
Option 1 with team synchronizing view: right click the project > Compare with > Commit. You can choose your latest commit here, even if you haven't pushed it to repository.
Option 2 with diff view: If you want to see the "diff" version without committing, you can achieve this by right clicking your project > team > stashes > Stash Changes > check Include untracked files. This will save all of your changes to a stash. Then you will right click project > team > stashes > select stash you saved. You click the green arrow at the top right to re-apply all of your changes you stashed back to your code. In the same stash window, you will see a "Diff" tab at the bottom right. Clicking on the diff tab will show your changes in the red/green highlighted diff style. I wish there was a way to generate a diff view without stashing, but this is the only work-around I have found.