2017-02-16 112 views
0

我有一個拉請求合併衝突:Git的合併衝突,不想刪除任何

@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"; 

,我不希望刪除這些任意行。我想讓他們都成爲主人。

我該怎麼辦?我希望在拉取請求中看到更改,而不是刪除任何內容,只需將新內容添加到已存在的文件即可。

回答

2

你只需要刪除衝突標誌(<<<<<<<=======>>>>>>>):

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

詳情請參閱Resolving a merge conflict using the command line

0

我認爲你需要從代碼中刪除這些行:

<<<<<<< HEAD

=======

>>>>>>> sticky-header

只要記住一條簡單的規則,同時解決任何合併衝突。最終的代碼應該是什麼樣子?相應地進行更改並繼續。從一些你想要添加的行和一些已經添加的行在同一位置,選擇/修改正確的行。

0

我不想刪除其中任何一行。我想讓他們在主人身上擁有 。

我該怎麼辦?只有

刪除<<<<<<< HEAD=======>>>>>>> sticky-header,然後git add <file>git commit

我想在拉請求中看到的變化,而不是刪除任何 合併

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

如果您看到衝突,則表示您合併的兩個分支的文件改變的方式與您正在討論的文件的相同部分不同。這意味着您想要查看的更改不會丟失,因爲它們已保存在這兩個分支的提交中。