In this categoryVS Code Setup ยท 25
- How to Set Up GitHub Copilot in VS CodeStart
- How to Use Copilot Chat and Inline Chat in VS Code
- How to Install and Manage Extensions in VS Code
- How to Install the Continue Extension in VS Code
- How to Install Cline, the Autonomous Coding Agent, in VS Code
- How to Configure Continue with an API Model
- How to Set Up an AI Assistant in VS Code
- How to Run Continue with a Local Model Using Ollama
- How to Run Copilot, Continue, and Cline Together Without Conflicts
- How to Add an MCP Server to Cline
- How to Fix AI Suggestions Not Appearing in VS Code
- How to Install and Trust an AI Extension in VS Code
- How to Install a VS Code Extension from the Command Line
- How to Create a launch.json to Debug a Node.js App in VS Code
- How to Initialize a Git Repository in VS Code
- How to Stage, Commit, and Push Changes from VS Code
- How to Debug a Browser App in VS Code with the Built-in Chrome Debugger
- How to Resolve Git Merge Conflicts in VS Code
- How to Run Build and Dev Commands with tasks.json in VS Code
- How to Add Environment Variables to a VS Code Debug Configuration
How to Resolve Git Merge Conflicts in VS Code
Use VS Code's conflict editor to understand both sides of a merge conflict and resolve it cleanly without breaking your code.
A merge conflict happens when two changes touch the same lines and git cannot decide which to keep. It looks scary the first time, but VS Code shows both versions clearly and lets you choose. This guide walks through spotting a conflict, reading it, and resolving it with the built-in tools.
What you need
- A git repository open in VS Code
- A merge or pull that produced a conflict (the steps below explain what that looks like)
- A basic understanding of staging and committing
Step 1: Recognize the conflict
When you pull or merge and git cannot reconcile changes, it stops and reports a conflict. In the Source Control view the affected files appear under Merge Changes with a warning icon, and the files contain conflict markers.
Step 2: Read the conflict markers
Open the conflicted file. Git inserts markers around the clashing region. The block after the line with seven less-than signs is your current version (HEAD), and the block after the seven equals signs is the incoming version, ending at the seven greater-than signs. VS Code highlights both and adds clickable actions above them.
Step 3: Choose a resolution
Click one of the action links above the conflict: Accept Current Change keeps your version, Accept Incoming Change takes theirs, and Accept Both keeps both blocks. If neither side is fully right, just edit the text by hand and delete all the marker lines yourself. The goal is code with no markers left.
Step 4: Stage and commit the resolution
Once the file has no conflict markers, save it. In Source Control, stage the resolved file with the plus icon; this tells git the conflict is handled. When every conflicted file is staged, type a commit message and commit to complete the merge.
Result
The conflict is resolved, the markers are gone, and the merge commit is recorded. Your branch now combines both sets of changes the way you intended.
Watch related tutorials
35:00
18:22
1:42:18
28:14
41:09
9:47New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.