6

I just pulled some changes from a remote repository holding my teams project.

This is the message I received on pull:

Checkout Conflict

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?

pramodc84
  • 1,550
  • 2
  • 26
  • 32
CodyBugstein
  • 17,496
  • 50
  • 159
  • 312
  • Conflict occurs when your changes cannot be merged with what is coming in because the changes are essentially on the same line. You have two options either to revert your change or manually merge the changes and commit it later. – panzerschreck Sep 09 '14 at 05:36
  • http://wiki.eclipse.org/EGit/User_Guide : have a look at section 'Resolving a merge conflict' – Frederic Close Sep 09 '14 at 05:56

4 Answers4

11

I faced this issue today and below solution works for me.

  1. Do a git stash. This will consolidate all your local and conflicting changes.
  2. Do a git pull now
Zoe
  • 23,712
  • 16
  • 99
  • 132
Pushkin
  • 424
  • 3
  • 14
2

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.

See http://wiki.eclipse.org/EGit/User_Guide#Manual_conflict_resolution

Breandán Dalton
  • 1,481
  • 14
  • 20
  • Doing merge manually sounds right, but the EGit doc states the conflicted file should have ">>>>", "=====" and "<<< – chrisinmtown Jun 26 '15 at 15:48
  • That is puzzling. Perhaps the conflict is due to different end-of-line markers, or character encodings? I'm guessing wildly here. All I can recommend is that you get the two copies (yours and the version in the repository) and go through them both line by line to see what the differences are. – Breandán Dalton Jun 29 '15 at 10:32
1

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.

chrisinmtown
  • 2,253
  • 23
  • 35
0

In Eclipse :-

  1. Right click -> click on 'add to index'

Add conflict file in staged area

  1. Right Click ->click on commit

Add conflict file in local repository

  1. Pull

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.

  1. Right click ->click on add to index

  2. Right click -> commit and push