CodyBugstein
CodyBugstein

Reputation: 23322

Checkout conflict with files. How do I proceed?

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?

Upvotes: 7

Views: 63836

Answers (5)

Sudhir Gaurav
Sudhir Gaurav

Reputation: 107

Follow this steps,

  • Step1:
    • If you are using Windows OS, Use gitbash tool .
    • If you are using MAC OS, use terminal.
  • Step2: Go to your git project location using #cd <patch_of_project>
  • Step3: #git stash
  • Step4: #git pull
  • Step5: #git stash apply
  • Step6 : resolve conflict manually by this , Changes mentioned as Head(<<<<<< HEAD) is your change, Changes mentioned in branch(>>>>>>> branch) is other person change, you can update file accordingly.

Upvotes: 0

Breand&#225;n Dalton
Breand&#225;n Dalton

Reputation: 1639

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

Upvotes: 2

Vijay
Vijay

Reputation: 5010

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

Upvotes: 0

Pushkin
Pushkin

Reputation: 534

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

Upvotes: 11

chrisinmtown
chrisinmtown

Reputation: 4344

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.

Upvotes: 2

Related Questions