I think I am just merely (coming from an SVN background) confused with how Git conflicts are handled by EGit within Eclipse.
I understand that it shows textually in the normal standard method by which to show conflicts as stated here: http://www.kernel.org/pub/software/scm/git/docs/git-merge.html#_how_conflicts_are_presented however it isn't very clean and with thousands of lines of code it becomes unmanageable to avoid accidently deleting lines that are not meant to be deleted.
Is there any GUI within EGit that can show me each conflict with an step over ability?
I have searched around and I heard about the merge tool however when I follow the instructions by right clicking on the top level node of the tree (i.e. right click models folder that has the <> type icon denoting a conflict, which has a conflicted file of User.php within it) the merge tool is greyed out.
Am I using the merge tool wrong?
Edit
I found out that a bug can cause EGit merge tool to not show: Why is the merge tool disabled in Eclipse for a EGit-managed project? however I am using EGit 1.3.0 so I should be way past this bug.
I have given this question two days both here and on the EGit forums: http://www.eclipse.org/forums/index.php/t/371459/ unfortunately (even after everyone viewed it) no one had a real answer so I decided to solve my conflicts manually and just merge that way.
This way was, in reality, quicker and easier than trying to solve why the merge tools were not working for me, ironically.
Related
We recently have moved from SVN to GIT, and until recently, the problems with the move were if not minimal, at least manageable.
Until a few weeks ago, we just had a single active 'master' branch, which was the old SVN trunk. But then, we added a branch to do a major upgrade while keeping the master available for bugfixes that could then be easily deployed.
The problem is that as soon as the different project team members started to check stuff in, the Eclipse (Mars 2 with EGit) Team Synchronization perspective started showing stuff as needing to check in that really didnt.
The first time I synchronized, a load of incoming changes came in (the blue arrow) which was unusual as I hadn't seen any since moving to GIT, - we just had to do a PULL instead - so foolishly I accepted them in. That ended up merging the changes we had put in the trunk with the branch, which we DIDN'T want to do.
Worse, even after pulling in those changes, they still appeared but now as conflicts, even though I accepted them and the files were identical. Nothing I can do (Mark as Merged, Overwrite, Commit...) gets rid of them.
Anyway, the most unhelpful problem is that now the Team Synchronization brings in hundreds (currently 825!) supposed changed files when I do a synchronize now. Many of these files are obscure ones that havent changed in years, and are clearly unchanged yet they show up. Trying to sift through the file list to find what I have actually changed is too much effort, especially as Eclipse helpfully refreshes the list with all the items I removed from the view each time I make any change!
So basically now I am resorting to GitKraken, which has substandard diff tools but at least shows an accurate view of what needs checking in. Why they decided on the Duplo-sized fonts that take up so much window space in the staging area I have no idea. And it's SLOW.
I now have a healthy dislike for GIT because its such a faff compared to SVN, although I acknowledge a lot of this is down to the GIT implementation in eclipse.
So, does anyone have any tips about how to get Eclipse to recognize that most of these files shouldn't actually be displayed? Am I missing some configuration somewhere? When I right click on the project in eclipse and do Team > Switch To, it correctly shows the branch Im working on, so why is it so inaccurate? Im using Eclipse Mars2 4.5.2 with JGit 4.6.1
Any tips appreciated.
For anyone else having similar problems with this, I sort of have an answer.
My answer is, that Im not sure what got it working, but my team synchronizing perspective now shows 99% the correct view. I clicked on various things with increasing desperation to get this to work and then some combination of the below in the Team Synchronizing perspective had the right effect:
In the Synchronize tab, select the down arrow next to the view type and select either Java Workspace (for the master) or Git Commits (for the branch)
Click the down arrow next to the Synchronize icon at the far left, select Synchronize and then Git, then select the correct destination (eg ref/heads/master) and then clic on 'Include local uncommitted changes in comparison'
Hopefully thats of help to someone.
When trying to commit changes to git from eclipse, I often want to look, what exactly changed in the file. For some reason egit doesn't give me that option.
It only offers to compare with working tree, which makes no sense to me, since it will show no differences.
For example TortoiseGit has the option compare with base. But it is inconvinient to use external tool for making commit. Is there any solution with egit for this issue?
Double clicking on the file should open the compare view between the central repository version and local work space version of that file. Hope that helps you
I am trying to jump over my shadow and finally learn git at a basic level. Like countless beginners before me I ran into the dreaded "egit rejected non-fast-forward" error when trying to push after merging in the remote changes and "marking as merged".
It seems like I already found a solution for this problem, but it is cumbersome and not compatible with the eclipse compare editor. I do it like this:
Push my changes - causes the "egit rejected non-fast-forward" error
Pull changes - The compare editor now contains <, = and > markers. I can't comfortably compare and push around changes as the right side of the compare editor is empty and the left contains my changes and the remote conflicting changes above each other, which is pretty useless.
Painfully pick the parts I want by manually editing the text.
Am I using egit the right way?
Is there a way to properly use both sides of the compare editor?
I want to see my version which will be pushed and it's differences to the current remote version at all times during the merge.
I'm not familiar with egit, but it sounds like you are dealing with a merge conflict. Am I right in assuming that someone else also has push access to the branch you're working on? What likely happened is they pushed new changes to the branch, which is what is causing the rejection. And by pulling, you're trying to merge in some conflicting changes that you have to resolve. Here is a better explanation of the same problem.
The bad news is that merge conflicts always have to be resolved manually. The good news is that it looks like egit provides a merge tool for resolving these conflicts. This egit wiki page might help you find the comparison tool that you're looking for. Basically, just select the file that has conflicts and then select Team > Merge Tool
.
If that doesn't work, you can always confidently resolve merge conflicts just by using the git merge markers (<, >, and =). Read this for a detailed explanation of how those are used in Git. Basically, anything below <<< and above === will be your changes. The code below === and above >>> will be their changes. And you either have to pick which side you want, or you can customize it even further. by deleting everything and re-writing the code yourself.
Here's an example. This is something you might see when resolving a merge conflict. The top show you the commit at your local HEAD, your version of the commit. And the bottom, below the === shows the commit at origin/master, the version you just pulled in.
<<<<<< HEAD:test.html
<h1>This is my version</h1>
======
This is their version
>>>>>> origin/master:test.html
To keep only your version, you could just replace that entire block with this. It's like the arrows and equal signs are giving you a choice. Do you want the top (yours), or the bottom (theirs)?
<h1>This is my version</h1>
Alternatively, maybe you want a combination of both. Here, you would be keeping your <h1> html tag, but using their text.
<h1>This is their version</h1>
I hope this helps you feel more comfortable with resolving merge conflicts. If you want to learn more about Git, I always recommend git-scm.
Eclipse Jave EE IDE for Web Developers
Luna Service Release 2 (4.4.2)
Eclipse EGit 3.4.2.201412180340-r
So I am merging between two Git branches in Eclipse, something that I have done dozens of times without incident.
This time, for some reason, conflicts were detected. I'm not sure why. But nothing I do in Eclipse lets me get rid of them. I've used the "merge tool". It let me manually move over all the changes to just the way I wanted it to be. Saved the file, conflict did not go away. Won't let me add to index. Won't let me commit. Tried the Team Synchronizing perspective, with its "Mark as Merged" function. This had no effect, although I remember it fondly from the "bad old svn days".
Many outdated web pages exist which tell me about >>>>> and <<<<< marks. None of these are to be found in my file.
How do I get to the bottom of this? Short of deleting the project from Eclipse and recloning it from the Atlassian stash it remotes to, how can I get out of this catch-22?
Update: answered my own question. see below.
Yup, it's definitely a bug in the eclipse git tooling.
After all this, I came upon Eclipse EGIT - all committed, pulled, merged, marked as merged, still on push I get "rejected - non-fast forward", what am I missing? and tried the solution referenced there. This was partially effective. I went straight to editing the conflicted file, and found the >>>>> and <<<<< marks. I was able to edit and save the file, and when I added it to the index, the marks went away.
But there was still a problem. My file contained both changes that were marked as conflicting and changes not marked as conflicting. When I edited the file directly ONLY the conflicted changes were in the file. The non-problematic changes did not make it into the file. To get those I had to do a manual compare of workspace with branch and move those over.
Sheesh.
So here is what we have.
The "merge tool" is worse than useless for conflict resolution. It strips out the >>>>> marks which makes manual editing difficult. Also, "Team-->Add to Index" doesn't work after you use the merge tool. Don't use it! At least until a fix is released.
Manual editing would work if the non-conflicting changes were added to the file.
Beyond this, there shouldn't have been a conflict anyway. The "conflict" amounted to a blank line vs. a section of new code. If the differencer can't figure that out, that's a problem too.
Oops, from the history view, there is Reset-->Hard Reset. That gets me back to pre-merge. I feel dumb for having posted this question but will leave it up in case someone else hits this.
I been trying to follow this tutorial on using Eclipse and GITHUB when multiple people are writing within the same project using branches. I believe I understand everything and how its working.. HOWEVER.. my hash isn't updating like the video is showing on local branches.
https://www.youtube.com/watch?v=KfeqnernMmE
If you look at minute 3:50 - 3:60 you will see him do a COMMIT and it will then update on the local branch and generates a new HASH etc...(text in grey next to ChangeDefaults in the video) My Eclipse won't freaking do this. I make a change exactly like he does, I do a commit, but my Hash's and comment text (all the text in GREY) don't update or change at all. They same the exact same as it was before and I'm not seeing any onscreen errors or anything.
What am I missing?
Apparently there were 2 things I was doing wrong.
1) I wasn't using the correct Repository when I was modifying things. I had the wrong "Project" open.
2) I was missing an update and had to update my GIT inside my eclipse.