> For the complete documentation index, see [llms.txt](https://docs.flosum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flosum.com/devops/code/branch-actions/resolving-smart-merge-conflicts.md).

# Resolving Smart Merge Conflicts

{% hint style="warning" %}

#### Written for the Old UI

This article was written for the old UI. The instructions are still usable, but the screenshots are outdated. In some cases, items referenced in the instructions have moved or changed. If you cannot find an item, see the [Where Did It Go](/devops/new-ui-ux-transition/where-did-it-go.md) article.
{% endhint %}

## ![](https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG5ZbxX918xOHwbAwAJ4n%2FSummary2-Small-Icon.svg?alt=media\&token=da26a67f-ff7f-47b3-8669-06be960dc2d7) Overview

A merge conflict occurs when the merge process cannot automatically apply changes from the source components to the target components. Because Smart Merge and Pull Requests share the same underlying causes of conflicts, the article on resolving Pull Request conflicts is a helpful reference for understanding why conflicts happen.

* [Resolving Pull Request Conflicts](/devops/pull-requests/pull-request-process/resolving-pull-request-conflicts.md)

This article provides detailed instructions for resolving Smart Merge conflicts.

### **How to resolve a Smart Merge conflict?**

When a Smart Merge encounters a conflict, you can resolve it by either retaining or overwriting the target's changes. For multiple conflicts, address each one separately, and you can use different methods for different conflicts.

**Retain Target Changes**: Use the Smart Merge built-in resolve conflict process to commit the conflicting lines from the target branch into the source branch.

**Overwrite Target Changes**: Manually commit the changes from the source branch into the target branch. Because Smart Merge is a single-step process, you must cancel it before committing these changes. Once the changes are committed, you can restart the Smart Merge.

{% hint style="warning" %}
If any conflicts require the **Overwrite Target Changes** method, resolve them first, since this method requires canceling and restarting the Smart Merge process.
{% endhint %}

## Resolving Conflicts

{% stepper %}
{% step %}

### Smart Merge Conflicts

During the Review Changes step of a Smart Merge, the Target and Source branches are checked for conflicts. If conflicts are found, a warning is displayed, and you must resolve them before completing the Smart Merge.

<div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FVbToBoSarBZCbISoQfpF%2FResolvingSmartMergeConflicts-S01-01.png?alt=media&amp;token=3f2a2c9c-e102-40a8-938b-02821c34c7f2" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Review Conflicts

1. Click **Resolve conflicts**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F0356eiIh5Ym4VIfY1eS5%2FResolvingSmartMergeConflicts-S02-01.png?alt=media&amp;token=8c68c9ba-fc6c-4726-86de-7cd89c4a16bd" alt="" width="563"><figcaption></figcaption></figure></div>
2. The **Resolve conflicts in smart merge** page guides you through resolving each conflict.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2F0LH9lSDGT2q8fsLoTAxA%2FResolvingSmartMergeConflicts-S02-02.png?alt=media&amp;token=5b967870-bd0a-46a5-8cca-365ad34ed317" alt="" width="563"><figcaption></figcaption></figure></div>
3. To review a component's conflicts, click the component in the **Components with Conflicts** list on the left.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2Fr3Tc7IORUcHZaBZJmpUY%2FResolvingSmartMergeConflicts-S02-03.png?alt=media&amp;token=6d67ea82-c57e-427f-b596-7d1c96696670" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
All components need to be reviewed and resolved.
{% endhint %}

4. Review the conflicting code in the component and determine how to resolve the conflict.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FxsZbC35j3uCvc3rpGSiP%2FResolvingSmartMergeConflicts-S02-04.png?alt=media&amp;token=48bbc24e-acff-45e9-9435-c69ee4907fa8" alt="" width="563"><figcaption></figcaption></figure></div>
5. There are two ways to resolve a Smart Merge conflict. See the following sections for instructions about how to perform each.
   1. **Retain Target Changes**: This method keeps the target's code by committing the conflicting lines from the **target** branch into the **source** branch.
   2. **Overwrite Target Changes**: This method keeps the source's code by committing the conflicting lines from the **source** branch to the **target** branch.

{% hint style="info" %}
For multiple conflicts, address each one separately using the most appropriate method; it's okay to use different approaches for different conflicts.
{% endhint %}
{% endstep %}

{% step %}

### Retain Target Changes

This method uses the **Resolve conflicts** feature built into a Smart Merge.

{% hint style="warning" %}
If any conflicts require the **Overwrite Target Changes** method, resolve them first, since this method requires canceling and restarting the Smart Merge process.
{% endhint %}

1. Click a component with conflicts to resolve.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FG6Z0Nwcgoad29t2wDCl3%2FResolvingSmartMergeConflicts-S03-01.png?alt=media&amp;token=2bc35fdd-5803-43a3-91cf-06bc622b19ec" alt="" width="563"><figcaption></figcaption></figure></div>
2. Click **Accept all** to retain all conflicting lines in this component, or click the **Right** **Arrow** for each line to retain. This copies the selected line from the target branch to the source branch.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FGG61iQfEOoxgO9HXFQwx%2FResolvingSmartMergeConflicts-S03-02.png?alt=media&amp;token=296c92a1-4636-4e41-adc7-528ed7b6650e" alt="" width="563"><figcaption></figcaption></figure></div>
3. Resolve all conflicts for a component.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FzsXDmR2teutGOQ1C39xO%2FResolvingSmartMergeConflicts-S03-03.png?alt=media&amp;token=4129b82a-0109-4e8d-9c36-23503c2cafee" alt="" width="563"><figcaption></figcaption></figure></div>
4. Click **Resolve** once all conflicts for a component have been resolved. This marks the component as resolved.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FCQlIcZp31cCP2KtYwEBz%2FResolvingSmartMergeConflicts-S03-04.png?alt=media&amp;token=c287d13c-0c63-457c-983e-8e968025d164" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Repeat this process for all components with conflicts.
{% endhint %}

5. Once all components are marked as **Resolved**, click **Resolve conflicts**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FLIv6giorWIBvo4WB3ARp%2FResolvingSmartMergeConflicts-S03-05.png?alt=media&amp;token=d2bbc664-2ca6-434c-9d6f-a5c85e41f740" alt="" width="563"><figcaption></figcaption></figure></div>
6. Enter a **Commit message**.
7. Click **Resolve**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FClLGRX1FvTCm6MrhlJD9%2FResolvingSmartMergeConflicts-S03-06.png?alt=media&amp;token=0f65041b-cea1-41e4-a434-f248af8c477d" alt="" width="563"><figcaption></figcaption></figure></div>
8. Once the conflicts are resolved, you will be returned to the Smart Merge Review Changes step.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FEH5Jjf6mCKCRogEmGqlg%2FResolvingSmartMergeConflicts-S03-07.png?alt=media&amp;token=e26e4603-a26a-407f-a56d-b7cf7daf671a" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}

#### Save Changes without Completing

To save changes for any **Resolved** components without completing the Resolve Conflicts process, follow these steps:

1. Click **Back** at the top of the **Resolve conflicts in smart merge** page.
2. In the dialog box that opens, select **Save & Proceed**.
3. Enter a **Commit message**.
4. Click **Resolve**.

This commits only components marked as **Resolved**. If a component has changes but is not marked as **Resolved**, those changes will not be committed.
{% endhint %}
{% endstep %}

{% step %}

### Overwrite Target Changes

This method requires manually editing and committing changes to the target branch.

{% hint style="warning" %}
To overwrite the target changes, the Smart Merge must be canceled.
{% endhint %}

{% hint style="info" %}
To make it easier to resolve conflicts when overwriting changes in the target branch, note the specific lines and components causing conflicts before you cancel the Smart Merge.
{% endhint %}

1. Click **Code** from the left sidebar menu.
2. Click the **target** branch of the Smart Merge.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FSsQB1qbUNF4JZKHKVSE1%2FResolvingSmartMergeConflicts-S04-01.png?alt=media&amp;token=76421e8b-0b24-4eab-8222-66899f6b74e2" alt="" width="563"><figcaption></figcaption></figure></div>
3. Click the **Three Vertical** dots at the right end of a component with conflicts in the Smart Merge.
4. Click **Edit**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FYIXGZ00yb4UctF5zxcYB%2FResolvingSmartMergeConflicts-S04-02.png?alt=media&amp;token=b2bbe6cc-e44b-4e8f-8a15-95ed09df0b42" alt="" width="563"><figcaption></figcaption></figure></div>
5. Edit the conflicting line or lines of code to match the **source** branch.
6. Click **Commit changes**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FQ2Q6tEKEkTHgOXp51rzp%2FResolvingSmartMergeConflicts-S04-03.png?alt=media&amp;token=d667f193-540b-4812-80c7-bf3a200c06f7" alt="" width="563"><figcaption></figcaption></figure></div>
7. Enter a **Commit message**.
8. Click **Commit**.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2Fk2hkRHZ0RXvW6457XIVn%2FResolvingSmartMergeConflicts-S04-04.png?alt=media&amp;token=f2c089fb-2da6-49e2-a68f-86c28e642889" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Repeat this process for all components with conflicts.
{% endhint %}

9. Once all components with conflicts are edited to match the **source** branch, restart the Smart Merge.

   <div align="left"><figure><img src="https://1800549522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRpUu5iMlzMFAudyBvMOl%2Fuploads%2FPN9Zvdv2yz1QkDFpLjeL%2FResolvingSmartMergeConflicts-S04-05.png?alt=media&amp;token=2123c66b-133b-404f-af62-b25af13b018a" alt="" width="563"><figcaption></figcaption></figure></div>

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flosum.com/devops/code/branch-actions/resolving-smart-merge-conflicts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
