Skip to main content

Version Control and Branch Management

Version Control

Currently the version control for Mendix is done using tortoise svn. For most practical applications, you should never need to use the tortoise tool, but if you cannot solve a conflict through the Mendix Modeler, refer to this documentation (https://tortoisesvn.net/support.html) for tortoise documentation and this link for Mendix integration (https://docs.mendix.com/refguide/troubleshoot-version-control-issues/).

Practical Mendix Version Control

In your initial Mendix Project, we had you disable connection to the version control server, to avoid bloating the Mendix Server. For this reason, once you complete this training, please delete your practice project from the server (tutorial on how to do this later). In addition, please be sure to include your name when doing the training, so we can know who to reach out to later.

To start, create a new project in your Mendix Modeler with the BYU Starter App, and this time SELECT enable version control.

Mendix has two methods of version control, with GIT being in early beta. For now, we will walk you through tortoise only until GIT is a more stable option.

AppSettings.png

We are going to keep the error handling simple for this example. To start, open the ‘Home_Web’ page. Add a container to the page and save it. In your changes tab you should see this:

Changes.png

From here we can commit our code. Hit the commit button, and add a message describing the change you made.

One of the nice features about this is the ability to revert all changes you’ve made. Add two more containers to the page and save it. On the topbar, go to version control > revert all changes. When you get the confirmation screen hit yes. This feature is incredibly helpful when attempting potential fixes for a bug that you want to revert when they fail to fix the issue.

Creating Branches

Creating branches is a simple process. To begin, on the topbar click version control > manage branch lines. You should see the following:

BranchLines.png

On this page you can see all branch lines, and swap to a branch that already exists. (It should be noted that in newer modeler versions, you can swap branches when opening the project, instead of needing to navigate all the way into the app). For our purposes, we are going to make a new branch. You can name it whatever you like, but for the purposes of this tutorial, I will call my branch ‘Branch1’. Afterwords, be sure to pick a revision (this is helpful for trying to diagnose when an error was introduced into the code)

When you make this branch, it will make an entirely new project in your Mendix directory. This is important if you are doing styles in an outside IDE. In the picture below ‘App’ has a main folder, and a Branch1 folder.

LocalBranches.png

On your home page, add a text element with the text ‘some text 1’, and commit the change.

Merging in a branch

Switch back to the main branch through the version control tab. Once you are on the main branch, go to version control > merge changes here, and pick the branch you created. Once you have finished that, the text you added in the above example should show up in your modeler.

Deleting a Branch

You can delete a branch from the same page you created it on. Go to version control > manage branch lines.

Once you delete the branch, it is important to note that your local copies of the app are not deleted. You will need to go to the local file directory, and delete them manually.

Basic Merge Conflicts

This tutorial will cover basic merge conflicts. This will not cover how to fix merge conflicts from css files. If you have a merge conflict in your css files, you will need to use tortoise svn manually.

For this tutorial, make two more branches like we did above. In this case, add UNIQUE text to each of the branches before committing. Merge one branch into main (this should have no conflicts), and then merge the second branch into main. It will successfully merge, but give you a notification that there are conflicts.

In the changes tab you will notice conflicts. You can either right click on the item and resolve with an entire document, or you can double click in and resolve changes 1 by 1.

PLEASE DELETE YOUR APP AT THE END OF THIS TRAINING