Visual Studio Code 1.20.0逐行合并冲突问题咨询
Hey there! I totally get how frustrating it is when you're trying to keep both local and remote changes during a merge conflict, but the built-in VS Code buttons just won't work. Let’s walk through some practical solutions for your situation:
1. 手动编辑冲突文件(最直接的应急方法)
VS Code marks merge conflicts with clear delimiters in your file—you can take full control by editing directly:
Open the conflicting file, and you’ll see sections like this:
<<<<<<< HEAD // 你的本地修改内容 ======= // 远程分支的内容 >>>>>>> [远程分支名称]
Follow these steps:
- Delete the conflict markers:
<<<<<<< HEAD,=======, and>>>>>>> [远程分支名称] - Keep exactly the lines you want (mix local and remote content freely)
- Save the file, then run
git add <文件名>in your terminal, and commit the resolved changes
This method works with any VS Code or Git version, no reliance on buggy UI buttons needed.
2. Upgrade VS Code to the latest version (highly recommended)
VS Code 1.20.0 is a pretty old release (from 2018!), and its merge conflict editor has known bugs—your unresponsive +/- buttons are almost certainly a version-related issue. The latest VS Code versions have:
- Fully functional line-by-line conflict resolution buttons
- A more intuitive preview interface for comparing local/remote changes
- Better overall Git integration
Upgrading will fix the button problem and give you tons of other useful features at the same time.
3. Install a merge conflict plugin (if you can’t upgrade right now)
If you need to stick with VS Code 1.20.0 temporarily, try these plugins to enhance conflict handling:
- GitLens: This popular plugin supercharges Git visualization and adds flexible conflict resolution tools, including line-by-line selection options
- Merge Conflict: A lightweight plugin built specifically to improve merge conflict editing, making it easier to pick and choose local/remote lines
After installing the plugin, reopen your conflicting file—you should be able to use line-by-line selection without issues.
Quick workaround for the old VS Code version
If the buttons still won’t respond, open the command palette (press Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac), type Merge Conflict, and look for commands like Accept Selected Changes. Sometimes using the command line trigger is more reliable than the UI buttons in older versions.
内容的提问来源于stack exchange,提问作者esseara




