0

After I wrote my code, I commit changes and I type git pull origin master to get other people changes. After that git said :

CONFLICT (content): Merge conflict in file.c
Automatic merge failed; fix conflicts and then commit the result.

I type git mergetool and fix conflict.

After that again I type git pull origin master and everytime git said :

error: Entry file.c' would be overwritten by merge. Cannot merge.

when I type git status I see other people changes.

I clean index and commit all other people changes to get rid of this problem

Why this is happen? What should I do after fix merge conflict?

I use git version 1.5.3.3

utarid
  • 1,642
  • 4
  • 24
  • 38

2 Answers2

1

You need to git commit the conflict fix first.

Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
  • Can you be more specific? – jub0bs Dec 08 '14 at 09:20
  • @Jubobs More verbose I guess, but I don't know how to answer this more specific than that fixing a merge conflict includes committing said fix – Tobias Kienzler Dec 08 '14 at 09:24
  • If I commit after merge fix, other people changes appear in commit. This is normal? Why I see other people changes? – utarid Dec 08 '14 at 10:59
  • That's the very point of fixing a merge conflict - you decide which changes to apply by committing. If you don't want that to happen you should instead try [`git pull --rebase`](http://stackoverflow.com/q/2472254/321973) (or if uncommitted changes are the problem, `git stash && git pull && git stash pop` – Tobias Kienzler Dec 08 '14 at 11:03
1

The sequence of commands here would be:

  1. pull latest code from repo using command: git pull origin master This shows conflicts.

  2. resolve the conflicts using IDE of your choice.

  3. commit the changes on your local.

Things should be fine next time you pull latest from master.

Jyoti Puri
  • 1,326
  • 10
  • 17