How to resolve merge conflicts?

Merge conflict occur when I committed but didn’t push a file named hello.c . At the same time, other developer also edited hello.c , and added a new file called world.c. And he committed and pushed the two files.

So, I use ‘git pull’ to update my working tree.Oops! There are conflicts.

  1. hello.c is a conflict file.

  2. world.c which state is added exists in my working tree.

In the case, I edit the hello.c and resolve the merge conflict.

However, git demand me to commit world.c again. Otherwise, world.c will be deleted in the repository.

Why does git demand me to commit again? How can I resolve this conflict without committing world.c again?

Thanks a lot.

Hi @kelvin7feng,

Have you checked out our help documentation on merge conflicts already? That would be a great place to start on this.

Additionally, we have a wonderful GitHub Learning Lab on resolving merge conflicts that walks you through it step by step that may help quite a lot.

I’d recommend starting with those resources and if you’re still having trouble, let us know.