简体   繁体   English

接受未出现在 VS Code 中的传入更改

[英]Accept Incoming Change not appearing in VS Code

I am trying to resolve merge conflicts into a branch using vs code.我正在尝试使用 vs 代码将合并冲突解决到分支中。 However the command palette to accept incoming changes is not appearing但是,接受传入更改的命令面板没有出现

在此处输入图像描述

Unlike here where the command palette is clearly visible at the top window.不像这里命令调色板在顶部 window 清晰可见。

How do I get those commands to appear at top of window?如何让这些命令出现在 window 的顶部?

In my case I had a different issue, my "Code Lens" was disabled.就我而言,我遇到了另一个问题,我的“代码镜头”被禁用了。

You can go to Settings and search for "codeLens" to make sure it is enabled.您可以转到设置并搜索“codeLens”以确保它已启用。

I suppose you're looking for this toolbar :我想你正在寻找这个工具栏

VS Code 合并冲突工具栏

(Image from this Microsoft Repo ) (来自此Microsoft Repo的图片)

This toolbar only appears when:此工具栏仅在以下情况下出现:

  1. there are any merge conflicts and有任何合并冲突和
  2. the current file is in the "MERGE" section of VS Code's version control panel当前文件位于 VS Code 版本控制面板的“MERGE”部分

From what I see in your screenshot, there is indeed a file in the "MERGE" section.从我在您的屏幕截图中看到的,“合并”部分中确实有一个文件。 I can't really tell whether that is also the file you've opened (Address.js).我真的无法判断这是否也是您打开的文件(Address.js)。

Address.js seems to have no conflict markers. Address.js 似乎没有冲突标记。 In git, conflict markers look like this:在 git 中,冲突标记如下所示:

<<<<<<< HEAD
    ...
=======
    ...
>>>>>>> master

In your case it seems like the change was merged by git automatically, without conflicts, which means the toolbar you're looking for won't show here.在您的情况下,似乎更改是由 git 自动合并的,没有冲突,这意味着您要查找的工具栏不会显示在此处。

In VScode settings (cmd + P , json settings) set:在 VScode 设置(cmd + P,json 设置)中设置:

  "editor.codeLens": true,

Mine was set to false and the commit actions weren't showing up.我的设置为 false 并且提交操作没有出现。

Taken from the links in @Teresa Kozeras answer.取自@Teresa Kozeras 答案中的链接。

Set to True:设置为真: 在此处输入图像描述

Set to False:设置为假: 在此处输入图像描述

This isn't exactly the question OP asked, but it's the one I was having when google brought me here.这不完全是 OP 提出的问题,但这是我在谷歌把我带到这里时遇到的问题。

I hope this help somebody.我希望这对某人有所帮助。 If the Accept Current Changes and stuff does not appear when git rebasing.如果 git rebase 时没有出现 Accept Current Changes and stuff 。

在此处输入图像描述

Just cut the greater than >>>>>>>> [Commit message] and paste it in any lines after the equal ======= signs and within those signs are the codes for Accept Incoming Changes .只需剪切大于>>>>>>>> [Commit message]并将其粘贴到等于=======符号之后的任何行中,在这些符号中是Accept Incoming Changes的代码。

First, as I found out, there are two types of related views, a diff/compare view (red/green lines) and a conflict (azure lines as seen in you gif) view.首先,正如我发现的那样,有两种类型的相关视图,差异/比较视图(红/绿线)和冲突(在您的 gif 中看到的天蓝色线)视图。

IF you have a merge conflict, the file in the sidebar will be put under "MERGE CHANGES", and you can click it and it opens like a regular file (just the filename in the tab and nothing else).如果您有合并冲突,边栏中的文件将放在“合并更改”下,您可以单击它,它会像常规文件一样打开(只有选项卡中的文件名,没有其他内容)。

However, I had a problem of not seeing any conflict highlighting or toolbar to accept or revert changes, until I figured that it doesn't scroll to the conflict automatically (I had a 40k lines file), and the only way you can spot conflicts as far as I can see, is in the scrollbar with small azure colorings.但是,我没有看到任何冲突突出显示或工具栏来接受或恢复更改,直到我发现它不会自动滚动到冲突(我有一个 40k 行文件),这是您发现冲突的唯一方法据我所见,是在带有小天蓝色着色的滚动条中。 Then when you scroll to them, the conflict and related actions appear.然后,当您滚动到它们时,就会出现冲突和相关操作。 That's on VS Code, I think, to implement such changes (auto scroll to first conflict, as well as separate buttons to go to next/previous conflict).我认为,这是在 VS Code 上实现此类更改(自动滚动到第一个冲突,以及单独的按钮转到下一个/上一个冲突)。 There are keybind options, though.不过,有键绑定选项。

Cheers干杯

对我来说禁用 GitLens 有帮助: https ://github.com/eamodio/vscode-gitlens/issues/319 https://github.com/eamodio/vscode-gitlens/issues/344

在此处输入图像描述 Try to change "git.mergeEditor": false in your VS code settings.尝试在 VS 代码设置中更改"git.mergeEditor": false

In case someone still can't solve this issue.万一有人仍然无法解决这个问题。 You can turn off the Git: Merge Editor from Setting menu.您可以从Setting菜单中关闭Git: Merge Editor

在此处输入图像描述

VSCode merge conflict options not displaying VSCode合并冲突选项不显示

What resolved this for me was to disable Git Merge Editor.为我解决这个问题的是禁用 Git 合并编辑器。 You can find this in File > Preferences > Settings and then search for Git Merge Editor.您可以在File > Preferences > Settings中找到它,然后搜索 Git Merge Editor。 After unticking the box, you should restart VS Code.取消选中该框后,您应该重新启动 VS Code。

在此处输入图像描述

I had the same problem after having some strange update issue with vscode.在 vscode 出现一些奇怪的更新问题后,我遇到了同样的问题。 I just had to uninstall and install the latest(1.27.1 at the time of writing) version of vscode and it worked again.我只需要卸载并安装最新版本(撰写本文时为 1.27.1)的 vscode,它就可以再次运行。

This just happened to me too, the solution for me was to open settings (command+comma), search for merge, and disable Git: Merge Editor.这也发生在我身上,我的解决方案是打开设置(命令+逗号),搜索合并,然后禁用 Git:合并编辑器。 在此处输入图像描述

Below is the most simple, easy and fast way for all:以下是最简单、最简单、最快捷的方法:

Disable Git Merge Editor .禁用 Git 合并编辑器

  1. Go to File > Preferences > Settings in VS code Go 到文件 > 首选项 > VS 代码中的设置在此处输入图像描述
  2. Search for Git: Merge Editor.搜索 Git:合并编辑器。 在此处输入图像描述
  3. Untick the check box and restart Vs Code取消勾选复选框并重新启动 Vs Code

Enjoy!!!!!!!!!!!!!!!!享受!!!!!!!!!!!!!!!!

我有同样的问题,我挣扎了几个小时,但没有任何效果,然后通过重新启动 vs 代码解决了问题

You may not also be able to see "Accept Change(s)" because recently VS Code introduced Git merge editor , which is now enabled by default.你可能也看不到“Accept Change(s)”,因为最近 VS Code 引入了Git 合并编辑器,现在默认启用。

It allows you to view and resolve merge conflicts by clicking on a conflicting file in the Source Control view instead.它允许您通过单击源代码控制视图中的冲突文件来查看和解决合并冲突。 You can turn it off to go back to "Accept Change(s)", though I think it's better.您可以将其关闭到 go 回到“接受更改”,尽管我认为它更好。

Add this line to VS Code user settings.json to turn merge editor off: "git.mergeEditor": false将此行添加到 VS Code 用户 settings.json 以关闭合并编辑器: “git.mergeEditor”:false

I'm attaching screenshots for anyone want to compare merge.editor off & on.我正在为任何想要比较 merge.editor 关闭和打开的人附上屏幕截图。

Git merge editor - off Git 合并编辑器-关闭

Git merge editor - on Git 合并编辑器 - 开启

只需剪下 >>>> 并将其在 ==== 之后的任何行中过去,这将使工具栏出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM