rits
rits

Reputation: 1544

Git merge conflicts, don't want to remove anything

I have a merge conflict in a pull request:

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

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

What should I do? I want the changes to be seen in pull request and not remove anything, just add the new stuff to already existing files.

Upvotes: 0

Views: 810

Answers (3)

smarber
smarber

Reputation: 5084

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

What should I do?

Only remove <<<<<<< HEAD, ======= and >>>>>>> sticky-header, then git add <file> and 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

If you see conflict, it means the two branches you merging have changed differently the same part of the file you're talking about. Wich means the changes you want to see won't be lost because they are already saved in the commits of these two branches.

Upvotes: 0

Sagar Kulkarni
Sagar Kulkarni

Reputation: 2081

I think you need to remove these lines from your code:

<<<<<<< HEAD

=======

and

>>>>>>> sticky-header.

Just remember a simple rule while resolving any merge conflicts. What should the final code look like? Make the changes accordingly and proceed. From some of the lines you want to add and some already added lines at the same position, choose/modify the correct one.

Upvotes: 0

Maroun
Maroun

Reputation: 95998

You only need to remove the conflict markers (<<<<<<<, =======, >>>>>>>):

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

See Resolving a merge conflict using the command line for more details.

Upvotes: 2

Related Questions