Failed merge in EGit - eclipse

I did a fetch from my remote origin to get the latest master branch that my friend had pushed to. I wanted to merge with my own master after the fetch, but whenever I do a merge with origin/master it just says "Failed". I've made hard resets before trying again with same result.
Since "Failed" is pretty vague I'm asking here what to do.
I have looked on the Egit wiki, but they don't mention failure as a possible result. This tutorial says that "A Failed result may occur when there are already conflicting changes in the working directory.", that's all I've found by googling.
Egit 2.2.0
Eclipse Build id: 20130225-0426

So the problem was Egit failed a merge without saying why.
After playing around in the staging view and, by a leap of faith from someone not entirely comfortable with Git, added all the unstaged files to the index (which is strange since I did a hard reset, why should there be differences?) I committed it. After I had done the commit, another file (a .jar) popped up in the unstaged list (why wasn't it there until I made my commit? Seriously). I added it to the index and committed. Finally there were no unstaged files.
I tried merging, and it worked. At last I got the "conflicted" result instead of "failed". Added everything to index and committed. Finally I seemed to have merged successfully, and I could push.
Honestly can't tell if I made mistakes or if Egit doesn't work properly.

In the Git repositories view.
1. right click the local -> master branch
2. select push branch -> next
3. it pop up a 'select push destination' window, check the 'force update' in it.

Related

EGit - how to see fetch history

Working in Eclipse with EGit. We have code on GitHub. My collaborator pushed changes to GitHub. I can see them on GitHub. When I try to do a fetch, EGit says everything is up to date. However, when I do a Synchronize Workspace on my local machine, it does not show the changes that are on GitHub. Someone suggested that perhaps the changes had already been fetched, which seems rather mysterious to me, but I want to check out that possibility. I cannot find any way, though, to show the fetches that have been done. Is there a way in EGit to see what has been fetched, short of merging it? Or failing that, a command line git command?

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.

Github DETACHED HEAD error when working with another developer

A developer and I were working on using .gitignore to add some conditions to the C# projects and solutions we were committing, since he previously encountered an issue of being unable to commit as a result of us committing binaries (such as .suo) to Github as well, which caused conflicts.
We fixed that issue of the .gitignore, now it ignores a number of conditions. However, when I went back to my computer, I am currently getting the DETACHED HEAD error. I did a git status, and the command line has been giving me these messages.
I am unsure how to solve this issue. I was wondering what I can/should do so I can go back to Master and commit/sync my changes?
Also, how do I prevent this issue in the future?
http://puu.sh/6EY9d/ae25db08b9.png
I was in rebase, so I ran git rebase --abort to get out of that.
Afterwards I was back in master, which allowed me to commit again.

How do I get back my files marked as deleted in the unstaged changes area of Git staging?

I'm running Eclipse Kepler Service Release 1 with egit for versioning. I've been using eclipse and egit for just a few months and am not up on all of it's intricacies yet. I've found some related questions here for git, but I don't really understand how to use egit to accomplish what the answers propose.
The immediate problem I have is that no files are visible in the project tree except for the libraries and WEB-INF under war. The files show up in the unstaged changes area of the Git staging window marked with an x as deleted. This is a jsp project running google app engine if it matters.
What got me to this point was attempting to checkout the master branch. I got an error saying the branch could not find 2 files and afterwards my working files in the current branch disappeared. The Git repositories view shows my current branch is the same as the one I had been working on, so these files should normally be visible.
Since I never chose to delete these files I have no idea what stage egit thinks it's in. I don't have a backup and my other branches haven't had recent changes merged in.
You can always see the state of Git as a text decoration next to each repository node in the repositories view of the Git perspective. Normally that should only show the branch name, but it might also be something like "Interactive rebase", if Git stops for user input in the middle of an operation.
If that is not showing the branch name you want, then just the context menu Switch->[branchname] should bring you back to the wanted branch.
If everything else fails, you can always throw away all local changes and have your local working directory reset to the state of any commit (or branch) by using context menu->Reset->Hard and select the commit (or branch) to which you want to reset. Be aware that this wipes out any uncommitted local changes.
In case of more questions, you should read the very detailed EGit user guide.

Eclipse-fetch says my Git repo is current so what's the ↓13 mean?

As a git noob, Eclipse is not helping my confusion... I switched to me local master branch and ran a fetch with the settings below:
Firstly I don't understand why the "Next" button is disabled. Secondly when I run the fetch using "Finish", it tells me I am already up to date (makes sense as I already fetched). So what does the ↓13 mean? Isn't it telling me my local branch is behind the remote branch? Or that the remote branch is itself behind... but this is the remote master so what can it be behind of?
It means that you are 13 commits behind the origin.
If the arrow is pointing up, that means that your branch is X commits ahead of the origin.
As far as your Next button being grayed out. I believe it's because you havn't selected the Ref yet. Click the ref, and then you should see it.
FYI - when i started out with Git, i tried to use the eGit plugin for Eclipse, and I can say to you as a new person in Git. Use command line! I've had my local git repositories corrupted from the plugins, and it's not very intuitive.