In Git, the same operations as in SVN can be performed with some small changes. For example, during a commit in SVN, changes would first be pulled from the remote repository, these changes are then committed and pushed to the remote repository. However, in Git there are both local repositories and remote repositories. The difference here is that Git allows for better control when something needs to be pushed to the remote repository. When a commit is created, it will be added to the head of the current branch in the local repository and it is only when a push operation is performed that the changes will then appear on the remote repository. The result is that this provides far better versioning and control of changes. The disadvantage, and something to be mindful of, is that if changes are not regularly pulled or pushed, branches will diverge making merge conflicts a bigger risk and harder to resolve.
Another change for the better with Git is where merging is performed. In SVN, merges happen on the server side as soon as a commit is performed. However, with Git, merging can be performed when pulling, pushing or merging branch lines locally or on remote repositories. For this reason, managing conflicts is easier with Git as there is greater control over local change. If there are significant problems in the local repository, they can be overwritten by pulling the remote repository. Revisions are also tagged in different ways between the two. SVN will sequentially count between each version (1,2,3,4…) whereas Git will generate a hash for each commit. In Git these hashes can be referenced to perform operations such as checkout, cherry-pick or diff.
How to setup a new application and convert an existing application with Git version control
When creating a new application, the template and version control system are configurable for Mendix versions between 9.12.0 and 9.23.0. To use Git, after selecting the template, set the repository type to Git. Once selected, click the ‘Select Template’ button and Mendix will create both the app and the repository.
To convert an existing application’s repository to Git, navigate to the application in the Developer Portal. At the top of this page, a banner with the option to migrate to Git will appear. Clicking on ‘Migrate to Git’ will prompt you to check certain conditions to ensure that the repository is suitable for migration to Git. Once the prompt has been confirmed, clicking ‘Start Migration’ will start the process. Mendix will then migrate the repository and notify by email when the migration is complete.