Git 合并冲突,不想删除任何东西

Git merge conflicts, don't want to remove anything

我在拉取请求中有合并冲突:

@import "includes/_variables.scss";
@import "includes/_mixins.scss";
@import "includes/relatedProducts/_styles.scss";
<<<<<<< HEAD
=======
@import "includes/stickyHeader/_styles.scss";
>>>>>>> sticky-header
@import "includes/_responsive.scss";

而且我不想删除这两行中的任何一行。我想把它们都放在 master 上。

我该怎么办?我希望在拉取请求中看到更改而不删除任何内容,只需将新内容添加到现有文件中即可。

您只需删除冲突标记(<<<<<<<=======>>>>>>>):

@import "includes/_variables.scss";
@import "includes/_mixins.scss";
@import "includes/relatedProducts/_styles.scss";
@import "includes/stickyHeader/_styles.scss";
@import "includes/_responsive.scss";

请参阅使用命令行解决合并冲突 了解更多详情。

我认为您需要从代码中删除这些行:

<<<<<<< HEAD

=======

>>>>>>> sticky-header.

在解决任何合并冲突时,请记住一个简单的规则。最终代码应该是什么样的?相应地进行更改并继续。从您要添加的一些行和在同一位置添加的一些行,choose/modify 正确的行。

and I don't want to remove either of those lines. I want to have them both on master.

What should I do?

仅删除<<<<<<< HEAD=======>>>>>>> sticky-header,然后删除git add <file>git commit

I want the changes to be seen in pull request and not remove anything Merge

If you changed the same part of the same file differently in the two branches you’re merging together, Git won’t be able to merge them cleanly. git conflict

如果您看到冲突,这意味着您合并的两个分支对您正在谈论的文件的同一部分进行了不同的更改。这意味着你想看到的更改不会丢失,因为它们已经保存在这两个分支的提交中。