What to do when Git cannot automatically merge changes and a conflict occurs.
A merge conflict happens when you try to merge two branches that have competing changes. This occurs when both branches have edited the same line in the same file, or when one branch deletes a file that another branch has modified. Git cannot automatically decide which change is correct, so it pauses the merge process and asks you to resolve the conflict manually. When a conflict occurs, Git will mark the conflicted areas in the affected file with visual indicators (`<<<<<<<`, `=======`, `>>>>>>>`). Your task is to open the file, examine the conflicting sections, and edit the file to keep the version you want. This might mean keeping the code from one branch, the other branch, or a combination of both. Once you have edited the file to your satisfaction and removed the conflict markers, you must save the file, stage the resolved file using `git add <filename>`, and then finalize the merge by running `git commit`.