I just pulled some changes from a remote repository holding my teams project.
This is the message I received on pull:
Apparently, one of my partners made changed to the same file as me.
How do I proceed from here? The message is very vague. Was there an error? Do I have to undo what I did? Does he have to?
I faced this issue today and below solution works for me.
- Do a git stash. This will consolidate all your local and conflicting changes.
- Do a git pull now
Do you have uncommitted changes in the file that’s in your working copy? Or is your working copy clean? The EGit documentation guides you thru the latter scenario.
In my experience, the error dialog posted by @lmray is what EGit shows when a local working copy has uncommitted changes. EGit wishes to merge in information from the remote but I’m told it will not modify a dirty working copy. To proceed, you must first commit your changes locally, giving you a fallback point, then request merge again. The merge should then produce a merged file, hopefully without any conflicts.
Thanks to @B. Dalton for trying to straighten me out – my dirty working copy file had uncommitted changes, and a local git wizard explained things.
Digression: this is a mental adjustment if you (like me) were used to working with SVN, which would happily pull remote changes into a dirty local working file. Not saying that was better, just that git works differently. I’m still struggling to convert my SVN-trained intuition over to suitable expectations for Git.
You must manually resolve the conflict by incorporating your partner’s change into your code and committing the manually merged file.
Alternatively, if your changes aren’t too complex, you may revert (throw away) your changes to that file, update your code to pick up your partner’s changes, and then redo your work.
In Eclipse :-
- Right click -> click on ‘add to index’
Add conflict file in staged area
- Right Click ->click on commit
Add conflict file in local repository
You will get all changes (change in remote repository and local repository)
Changes mentioned as Head(<<<<<< HEAD) is your change, Changes mentioned in branch(>>>>>>> branch) is other person change, you can update file accordingly.
Right click ->click on add to index
Right click -> commit and push