Rebase

While still on the master branch, click on Rebase in the Git pane, and select the feature1 local branch as the source for the rebase operation.

The following message appears:

Click OK.

Now the Git pane is in “Rebase Interactive” mode.

You can see that the sample.txt file is in conflict – the little red icon next to the file name indicates the conflict status .

To resolve the conflict, double-click the file in the staging table to open the Compare editor.

On the right, you can see the file from the source branch (feature1) and on the left you can see the file from the target branch (master). Row #3 is conflicting and we need to decide which value we want.

For the sake of this example, let’s assume that the correct value is the one coming from the feature branch (i.e. 555).

Click on the “Copy from right to left” button.

This will copy the 555 from the feature1 branch version to the master branch.

You can also manually edit the file on the left with a different value (yes, the compare editor is also editable).

Save and stage the file.

Click Continue in the Git pane.

Now you should be back to the standard view of the Git pane with your changes merged from feature1 to master.

Merge

While still on the master branch, click on Merge in the Git pane, and select the feature1 local branch as your source for the merge operation.

Click OK.

The following message appears:

Click OK.

Now the Git pane is in “Merge Interactive” mode.

You can see that the sample.txt file is in conflict.

As we saw in the previous section, we can use the compare editor to fix and resolve this conflict.

However, I want to show you how this is done using the standard code editor.

Open the sample.txt file in the code editor by clicking the 3 dots in the staging table and selecting Edit.

This is what the file looks like in the code editor:

The code that was changed in the master branch appears under the <<<<<<< HEAD statement:

The code that was changed in the feature1 branch appears above the >>>>>>> feature1 statement:

All we need to do now is to clean-up the code and leave only the text that we want to keep in our file. Let’s assume we want to keep the 555 form the feature1 branch. This is what the file should look like after our edit:

Save and stage the file.

Add a commit message and commit the change.

This is what the commit history looks like after the change was merged to the master branch: