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
Related
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.
I'm using Atlassian Stash, and the Git plugin for Eclipse Kepler, and I'm trying to clone a repository. As soon as I complete it, I immediately end up with N unstaged changes, where N vary everytime I try it. When I try and compare the two files that are apparently different, there isn't a single change. I'm guessing there may be some differences between the metadata of the files, but since I can't find what exactly has changed I don't want to commit/push the files either. Like I said, the number of files that have changed are completely random, and the kind of files that have been changed are also pretty random. (.project, .java, .groovy, +more).
I have had a look at this question, this question, and this question but none of them solved my question.
Any ideas as to why this happens?
Like already mentioned in the comments,this is a line-ending problem.
I also had this issue one day.
The git plugin(egit) you are using does have a issue with .gitattributes where you can configure how line endings should handled.
- If you are using the plugin and still want to use it, you need to have to fix the line endings first and than configure your line endings in your IDE to use Unix-Line-Endings, as well as on the other(usually Windows) machine. This will solve the line ending problem for new files.
I am totally against the fact that git should handle your line-endings, you as a developer are responsible for managing this. So let your IDE handle this issue and configure it as already mentioned.
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.
Could you advise me some svn plugin for eclipse that visualizes changes made to file? I know there is built-in feature in Text Editors - Quick diff, but it shows differences in overview ruler and I want to see changes as a highlighted lines.
UPD: Why do I need it. I often change existing code for some reason. That changes does not have to be committed, so before commit I am reverting them. To do it I run tortoise svn and see which changes are necessary and which are not. That is a bit cumbersome every time switching from tortoise svn to eclipse and back. But if I could see changes right in java editor that would be cool.
http://subclipse.tigris.org/
Compare with some revision to see changes - under "team"
I found How I can do it. There is blame feature which annotates file with revision where last change was made. And for new lines that annotation is empty. Just what I wanted!
When i do a synchronisation of files or try to commit, there are also files shown that are not changed.
This is only when i did a merge from an other workspace to the one i get those files in.
When i take a look at those files, they have no difference from the files on svn.
anyone any idea?
seems that a newer version of Eclipse solves this problem!
when merging you get a 4 step wizard and in the latest step there is an option 'ignore ancestry'
if this is clicked, there wont be taken other files into this merge and the problem isn't there.
hip hip hooray
Did you check if the SVN properties on the files changed? SVN records the semantic information (merged revision range) in a property svn:mergeinfo when using the svn merge command.
It doesn't matter whether you use svn merge on the command line or Eclipse Team. Please read the documentation on mergeinfo to see what is going on. The property will track your merge history in the repository (a significant improvement over e.g. CVS).
(Edited after comment)