Topic 4

Conflict

A conflict is not a disaster. It simply means Git needs help choosing between overlapping edits.

What a conflict means

A conflict appears when two sets of changes touch the same lines or the same small region of a file.

Git stops and asks you to decide what the final text should be.

A common first sign is a push warning: the remote changed and you need to pull first.

VS Code warning that a push was rejected and a pull is required

After that warning, start the merge flow from the Source Control menu.

VS Code source control menu with Pull highlighted after a push warning

Resolve one file carefully

Use the VS Code Merge Editor or the conflict markers directly. Read the surrounding lines, decide what should remain, and keep the final text consistent.

Do not accept everything from one side unless that is the correct outcome.

VS Code source control panel during a merge with merge changes shown

Finish the merge cleanly

After resolving the file, confirm the conflict markers are gone, stage the file, and finish the merge commit or re-run the normal commit flow.

Before proceeding

If you can explain what the final file should say and the repository returns to a clean state afterward, the conflict has been handled correctly.