Merging

Overview

After branching, making changes, and receiving approval for merging those changes through code review, the last step is to merge your development branch back into the main branch.

There are two situations that you need to be aware of when merging your branch.

  1. Merging without Conflicts This means that no-one has modified the same files you were working on, in the original branch, while you were working on the branch.

  2. Merging with Conflicts This means someone has modified the same files you were working on in the original branch.

In case #1, you can just overwrite the original files with your changes, but in case #2 you will need to resolve the conflicts.

For Rockwell Studio 5000 and Siemens Step7 TIA Portal, Copia provides an Advanced Merge tool in the web app PR view to allow you to choose what sections of the code you want to include. Refer to these links for resolving merge conflicts using that software. For other merge conflicts, you will need to resolve conflicts manually in the Desktop app.

Desktop App Merge (no conflicts)

To merge your development branch back into main, click into the Current Branch dropdown, select the main branch, and click on the Choose a Branch to Merge into main button.

Select your development branch and press the Merge button. If you do not have any merge conflicts, the merge will perform as expected.

While you can always directly merge your changes back into the main branch, Copia recommends that you get into the habit of always creating a PR.

Desktop App merge (with conflicts)

If Copia's Advanced Merge Tool is available for this filetype, use the Copia Web app instead. Click Here for more information. If you have run into merge conflicts when attempting to merge a PR, follow the instructions below

If you attempt to merge a branch and someone else has already modified the file(s) within the main branch, you'll get the following warning:

You'll want to select your local version (the option NOT prefixed with origin/) and merge the files in. This will create a new commit. You can then navigate to the History tab to understand what you changed. We recommend you create another commit with the changes from remote that you overrode before pushing.

Handling PR conflicts in the Desktop App

If you're running into merge conflicts while trying to merge your pull request changes into the base branch, you can resolve them by following these steps:

  1. In the Desktop app, make sure the base branch and the feature branch are up-to-date with the latest remote changes. Select Fetch Origin from the top bar to pull the latest remote commits for your base branch.

  2. In the Desktop app, merge the base branch into your current feature branch by first ensuring that you are currently checked out in the feature branch, then in Branch settings, choose "Merge into current branch".

  1. After merging changes from the base branch, resolve all conflicts. You should bias towards selecting the changes made in your feature branch.

If you used the Advanced Merge Tool to resolve PLC file conflicts in the web app, it is very important to choose the version of the file from the feature branch

  1. After all conflicts are resolved, commit your merged and resolved changes and push them to your remote repository.

  2. After you've pushed your changes, go back to the web app and ensure that all changes look correct and after merge them into the base/target branch.

Last updated