Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I go about solving this git conflict?

Tags:

git

  1. I have made a central bare shared repo at foo.org.
  2. user A has done git clone ssh://foo.org/blah.git
  3. user A has created file 'lol' which is a blank file. Commits it to local repo. Does git push
  4. user B does mkdir foo and cd foo
  5. user B then does git clone ssh://foo.org/blah.git.
  6. user B edits lol file.
  7. user A edits lol file.
  8. user A commits and git push to central repo
  9. user B commits and git push and is given:

    error: failed to push some refs to 'ssh://foo.org/blah.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'non-fast forward'

  10. user b does git pull

    From ssh://foo.org/home/meder/central/foo 08a0cda..fba6968 master -> origin/master Auto-merging lol CONFLICT (content): Merge conflict in lol Automatic merge failed; fix conflicts and then commit the result.

  11. user b does vim lol and edits file to his liking. then tries git commit afterwards and is given:

    lol: needs merge lol: unmerged (039727ec5a50d0ed45ff67e6f4c9b953bd23c17d) lol: unmerged (9307e337aa159ed6574eb84532f107685e46a16c) lol: unmerged (f88ad411f67850938dc369426cdbba76812e9126) error: Error building trees

What do I have to do at this point? I tried a git merge but it says fatal: You have not concluded your merge. (MERGE_HEAD exists)

I know for sure I'm doing something stupidly wrong. Can someone just point out what it is?

like image 809
meder omuraliev Avatar asked Oct 28 '10 19:10

meder omuraliev


People also ask

What is a Git conflict and how are they resolved?

Luckily, Git offers powerful tools to help navigate and resolve conflicts. Git can handle most merges on its own with automatic merging features. A conflict arises when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other.


1 Answers

In step 11, has user b done a 'git add' to add their hand-merge, before 'git commit'?

like image 53
Graham Perks Avatar answered Sep 16 '22 13:09

Graham Perks