eGit checkout conflict - can't reset - eclipse

I have 2 branches: master & develop. I have been developing in "develop" and committed everything I need. What was left (application generated file: .out) I didn't care for! So when I went to switch branch, I got prompted following:
I clicked "Reset" however instead of switching to the branch I got prompted the same "Checkout Conflicts" windows with exactly the same choices. I clicked "Reset" again, however above process just repeated. I clicked a while -- no help the same happens again and again. More over I encountered the same scenario on different eclipses (Juno, Kepler) and different OS (Mac & Windows).
Am I doing something wrong? I don't want to commit or stash the file, I just want it to be reset. Is it a bug? Or there is a solution?
Thank you.

Add *.out to your .gitignore to get rid of those files once and forever.
In my version of egit, when i select reset, the reset window opens. Seems like a bug in your version. Try updating egit (not only eclipse).
If it still doesn't work, you can also use Team -> Reset... to perform a reset. After that you should be able to change the branches.
Actually, there are a few more ways to kill a file:
just delete the file
commit it and then reset the branch to the commit before that (effectively getting rid of that commit)
commit it and then perform an git rebase -interactive and delete the corresponding line
Feel free to edit this post and add more ways of violently killing a file from git!

Related

Going to another commit in GitHub Desktop (GUI VERSION)

How do I go to a previous commit from GitHub Desktop? I did some work in my class yesterday and today when I pulled it said I needed to resolve merges, so I clicked continue from Main. Now I do not have the version in my unity, but I do have it in History. I would like to go back to that version.
I do not have the command line, please only options on GUI version.
I do not want to try anything without asking because last time it caused a lot of errors and corruption in my previous project.
Create branch from commit is probably your best bet. It will ask you to enter a name for the new branch. Once your done you can use the branch tab to switch back to your development branch.

How to view file changes before pulling through GitHub on RStudio?

I'm transitioning from using Subversion in Eclipse for code management to GitHub in RStudio. It's starting to make sense, but I can't seem to figure out how to pull effectively.
Specifically, if I use the Pull arrow in RStudio, every file change in the repository automatically updates my local files without warning. I can see how many files were updated, but not what changed!
Here are the questions I'm hoping to get help with:
1) Can I preview the repository file changes in RStudio before I pull them locally? With SVN in Eclipse, there was an indicator showing files with a difference, and the option to view side by side.
2) If multiple files have been changed on the repository, is it possible to pull just 1 locally?
3) How can I revert a local file to a previous version?
Right now I've been trying to do this all within RStudio for simplicity. I haven't used things like the GitHub desktop client.
I appreciate the help!
I would suggest you better get used to the git's own tools to stay informed about your repository.
For example you could do following.
Before you pull, check your current commit logs
git log
This should show you how your current commits stack up. Note the latest commit id (first 4-5 letters would usually do)
Now after pulling you can see the difference using following command
git diff --color your_previous_commit_id..HEAD
If you don't like the changes and want to go back,
you can just reset to your favorite commit with following command. BTW run "git stash save" to keep a copy of your uncommitted changes.
git reset --hard you_favorite_commit_id
Note: that this will delete all your uncommitted changes unless you stashed them and put your local branch behind the remote repo branch you are tracking again.
Wondering where to put these commands? Check https://git-scm.com/downloads.
What's good about using these git tools is that if you switch between IDEs you don't need to search for same functionalities you had in your earlier IDEs.

Failed merge in EGit

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.

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.

Changing git branch while working with eclipse (what's proper order)?

my problem is that sometimes I change git branch while working live in eclipse. But I do not know what should I do (in what order to to, to don't make mess in both projects).
So my procedure is:
eclipse is open (working on some problems)
git change branch
eclipse > selecting projects and clicking to refresh
work on eclipse, continue job
Is it all right or I should use first Clear&Build and then refresh projects? What do you think, is it important witch order do this while changing branch ? Please help because I am working with friends on big project and I do not want break anything.
If you are working on a particular branch and you want to preserve whatever it is you have been doing, you should add or commit those changes first (git add or git commit) to that branch before changing to a different branch.
If you have the same projects in both branches, then refreshing the projects after changing branch should be fine, but ideally followed up with a clean/build.
If you want to be really safe, you can first close the projects before changing branch, then refresh and re-open them after changing branch.