VSCode中Git冲突文本显示红色的问题解决及是否需更换扩展的咨询
Hey there! I’ve run into similar syntax highlighting quirks in VS Code before, so let’s walk through how to get your Git conflict text back to the blue you’re used to, and figure out if you need to swap any extensions.
1. Check Your Theme’s Git Conflict Decorations
First off, theme updates or accidental theme switches are the most common culprit here. Here’s how to adjust it:
- Open VS Code settings with
Ctrl+,(Windows/Linux) orCmd+,(Mac) - Search for
git conflict decorationsin the settings search bar - You’ll see options for
current(your branch’s code),incoming(the conflicting branch’s code), andcommon(the base code) sections of conflicts. Click the color picker next to the one showing red, and set it back to your preferred blue (like#0066ccfor a soft, readable shade)
2. Reset Git-Related Settings to Default
If you’ve tweaked settings before and can’t remember what changed, resetting the config might help:
- Open the Command Palette with
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(Mac) - Type
Preferences: Open Settings (JSON)and hit enter - Look for any lines starting with
"git.conflictDecorations"— delete those custom entries, save the file, and restart VS Code. This will revert to your theme’s default conflict colors.
3. Troubleshoot Third-Party Git Extensions
VS Code’s core Git features handle conflict highlighting, but third-party extensions like GitLens or Git Graph can sometimes override these settings:
- Go to the Extensions panel (
Ctrl+Shift+X/Cmd+Shift+X), find all Git-related extensions you have installed, and disable them all - Restart VS Code and check if the conflict color is back to blue
- If it is, re-enable extensions one by one until you find the one causing the issue. You can either update that extension to the latest version (bugs get fixed all the time!) or replace it with an alternative if the problem persists.
4. Reinstall VS Code (Last Resort)
If none of the above works, there might be a corrupted file in your VS Code installation:
- Back up your settings and extensions (you can sync them via VS Code’s built-in sync feature if you’re signed in)
- Uninstall VS Code completely, then delete the residual config folders:
- Windows:
%APPDATA%\Code - Mac:
~/Library/Application Support/Code - Linux:
~/.config/Code
- Windows:
- Download and install the latest version of VS Code
Do You Need to Replace Extensions?
In most cases, no — you won’t need to swap extensions unless you’ve confirmed a specific extension is causing the conflict color bug. Start with adjusting theme settings and resetting configs first; those fixes are quick and usually resolve the issue.
内容的提问来源于stack exchange,提问作者ludenparis

