When you pulled, git found that the new changes you made affected some of the same parts of the code as were also affected by changes you hadn't yet pulled. That is why it generated a 'CONFLICT' message.
While it is nobody's favorite part of source control, conflicts (and conflict resolution) are a normal part of the process. They do not necessarily mean that anything was done wrong. If you're working alone and you can develop in a very linear way, then you could try to hammer out some discipline by which you can never have conflicts. But while git certainly can handle that use case, a big part of the point of git is that it can also handle non-linear cases (including efforts with many contributors who may be loosely coordinated).
The files you say are "messed up" contain conflict markers. As the git prompts indicated, git expects you to edit the affected files to decide how the files should look, accounting for both attempts to change them. (If you do git status
, it will reminder you which ones are yet to be handled.)
So you might see something in the file like
<<<<<<< HEAD
This is the result of the local edits to this section of code
-------
This is the result of the edits you are trying to merge in
>>>>>>> other_branch
You examine that, figure out a single block of code that will account for what you were trying to do in both instances, and so you replace it with
This is the result of applying all the changes in a way that work together
No more conflict markers, one cohesive piece of code. Do that for each conflict marker, save the file, git add
the file, and when status
says that everything is resolved / staged, you can complete the merge.