Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose individual lines in merge conflicts with GitHub extension for Visual Studio

I am using GitHub extension for Visual Studio 2017 whenever I want to merge two branches and get conflicts sometimes the extension decides certain lines of code can replace others and I am presented with only a single checkbox, either from the source or target but not both. I.e. I can only choose to replace that line of code or not, I cannot keep both.

How can I keep both without doing it manually for each line?

For example in the image below I'd like to have the result code of

List<Label> LabelsC = new List<Label>();
List<Label> LabelsCO2 = new List<Label>();

enter image description here

like image 301
mathgenius Avatar asked Oct 14 '25 18:10

mathgenius


1 Answers

You have three options while merging.

  1. You can select one checkbox you want to keep. It can be on both side. (You can choose your code or remote code.)
  2. You can also select both checkbox. In this case, your code will be appended to remote code. This append operations will be based on your line number.
  3. You can also change your code while merging. There is seperate tab below both your and remote tab which shows final output after merging. You also can edit that code and do line operations.

Actually this is perfect work flow as per git rules. All merge operations are embedded in VS. I think this video might help you.

like image 147
Jaimin Avatar answered Oct 17 '25 11:10

Jaimin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!