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 again world.c?

Thanks a lot.


Thanks for being part of the GitHub Community Forum. It looks like you’ve opened this same topic in multiple places. You have a similar post already:

For this reason, I will be locking this thread. You can continue the conversation in your original post. We do ask that you no longer cross-post in the Community Forum.

If you’re ever concerned that your post hasn’t shown up right after you made it, we recommend waiting at least an hour before attempting again in order to avoid accidental duplicate posts. Sometimes posts get caught in the moderation queue, but our team reviews them as quickly as possible.

For additional guidance, please review our Community Forum Code of Conduct.