You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/refguide/general/mx-command-line-tool/merge.md
+37-35Lines changed: 37 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
2
title: "Merging and Diffing Commands"
3
-
url: /refguide/mx-command-line-tool/merge
3
+
url: /refguide/mx-command-line-tool/merge/
4
4
weight: 50
5
-
description: "Describes the commands related to merging and diffing apps for the mx command-line tool."
5
+
description: "Describes the commands for comparing and merging apps using the mx command-line tool."
6
6
---
7
7
8
8
## Introduction
9
9
10
-
The commands in this group enable comparing two apps and merging them.
10
+
The commands in this group compare two apps and merge them.
11
11
12
12
## mx diff Command {#diff}
13
13
@@ -24,16 +24,17 @@ These are the `OPTIONS`:
24
24
| Option | Shortcut | Result |
25
25
| --- | --- | --- |
26
26
|`--help`|| Shows help for the `mx diff` command and exits. |
27
-
|`--loose-version-check`|`-l`| Makes the version check loose (meaning, it auto-converts if possible before diffing). |
27
+
|`--loose-version-check`|`-l`| Makes the version check loose. This auto-converts files if possible before comparing them. |
28
28
29
-
`BASE` is the first *.mpr* file, which is used as a base in comparison.
29
+
`BASE` is the first *.mpr* file, used as the base for comparison.
30
30
31
-
`MINE` is the second *.mpr* file, which is used as the changed version in comparison. The output will contain the changes that are in this file against the base.
31
+
`MINE` is the second *.mpr* file, used as the changed version for comparison. The output contains the changes in this file compared to the base.
32
32
33
33
{{% alert color="info" %}}
34
-
For example, if the `BASE`*.mpr* has Microflow1 and the `MINE`*.mpr* does not have it, Microflow1 will be listed as deleted in the output file. If you swap the `BASE` and `MINE` parameters and compare again, Microflow1 will be listed as added.{{% /alert %}}
34
+
For example, if the `BASE`*.mpr* file contains Microflow1 and the `MINE`*.mpr* file does not contain it, Microflow1 is listed as deleted in the output file. If you swap the `BASE` and `MINE` parameters and compare again, Microflow1 is listed as added.
35
+
{{% /alert %}}
35
36
36
-
`OUTPUT` is the name of the outputted JSON file.
37
+
`OUTPUT` is the name of the output JSON file.
37
38
38
39
### Examples
39
40
@@ -54,9 +55,9 @@ This table shows the return codes and their description:
54
55
55
56
## mx merge Command {#merge}
56
57
57
-
The `mx merge` command performs a three-way merge of two *.mpr* files by taking their common ancestor (base) into account.
58
+
The `mx merge` command performs a three-way merge of two *.mpr* files using their common ancestor (base).
58
59
59
-
The input is three *.mpr*files: `BASE`, `MINE`, and `THEIRS`.
60
+
The input is three *.mpr* files: `BASE`, `MINE`, and `THEIRS`.
60
61
61
62
### Usage
62
63
@@ -70,9 +71,9 @@ These are the `OPTIONS`:
70
71
| --- | --- |
71
72
|`--help`| Shows help for the `mx merge` command and exits. |
72
73
73
-
`BASE` is common base version of the app. If the app is version-controlled, this is the last common revision of the app (the revision that is present in the history of both branches).
74
+
`BASE` is the common base version of the app. If the app is version-controlled, this is the last common revision of the app (the revision present in the history of both branches).
74
75
75
-
`MINE` is the version to merge into. This *.mpr* contains the results of the merge.
76
+
`MINE` is the version to merge into. This *.mpr*file contains the results of the merge.
76
77
77
78
`THEIRS` is the version to merge changes from.
78
79
@@ -82,32 +83,33 @@ The image below illustrates the meaning of the parameters:
82
83
83
84
In the diagram, note the following:
84
85
85
-
* <spanstyle="color:green">**A"**</span> is `MINE`, which is the current commit you want to merge the changes to
86
-
* <spanstyle="color:orange">**B'**</span> is `THEIRS`, which is the last commit on a branch you want to merge changes from
87
-
* <spanstyle="color:red">**A**</span> is `BASE`, which is the common commit where the branches diverged
86
+
* <spanstyle="color:green">**A"**</span> is `MINE`, the current commit you want to merge changes into
87
+
* <spanstyle="color:orange">**B'**</span> is `THEIRS`, the last commit on the branch you want to merge changes from
88
+
* <spanstyle="color:red">**A**</span> is `BASE`, the common commit where the branches diverged
88
89
89
-
In order to merge changes correctly, Studio Pro has to compare both **A"** and **B'** against **A** to see what has been changed on each branch. During the merge, the [merge algorithm](/refguide/merge-algorithm/)will try to automatically merge the changes.
90
+
To merge changes correctly, Studio Pro compares both **A"** and **B'** against **A** to see what changed on each branch. During the merge, the [merge algorithm](/refguide/merge-algorithm/)attempts to automatically merge the changes.
90
91
91
92
This command works for any three *.mpr* files. This means you can try to merge different apps at your own risk.
92
93
93
94
{{% alert color="info" %}}
94
-
This command works differently than the normal version-controlled merges you can do in Studio Pro. While Studio Pro does a real merge of one branch into another, this command runs the merge algorithm over three *.mpr* files that do not even have to be version-controlled. {{% /alert %}}
95
+
This command works differently than the normal version-controlled merges you can do in Studio Pro. Studio Pro performs a true merge of one branch into another. In contrast, this command runs the merge algorithm on three *.mpr* files that do not need to be version-controlled.
96
+
{{% /alert %}}
95
97
96
98
### Conflicts
97
99
98
100
If there are conflicts during the merge, resolve them by opening the app in Studio Pro and selecting **Version Control** > [Merge Changes Here](/refguide/version-control-menu/#merge-changes-here).
99
101
100
-
The reason for this is that conflict resolution is a complex process that has two requirements:
102
+
Conflict resolution is a complex process that has two requirements:
101
103
102
-
* The app has to be version-controlled
103
-
* Your Git repository has to be in the merge state (Studio Pro does this when you click **Merge Changes Here**)
104
+
* The app must be version-controlled.
105
+
* Your Git repository must be in the merge state. Studio Pro sets this when you click **Merge Changes Here**.
104
106
105
-
This merge state is needed for Studio Pro to know what your current branch is and which branch you are trying to merge into it. This way, when you are trying to resolve the conflict using the `THEIRS` document, Studio Pro can download the document from the branch and put it into your current app.
107
+
Studio Pro needs this merge state to identify your current branch and the branch you are merging into it. When you resolve the conflict using the `THEIRS` document, Studio Pro can download the document from the branch and add it to your current app.
106
108
107
-
So, if you run this command from the command line specifying the three *.mpr* files but the result has conflicts, you will not be able to resolve the conflicts in the `MINE` app using the `THEIRS` documents by just opening the app in Studio Pro. Instead, you need to configure Git to use `mx merge` as a [merge driver](#merge-git-driver) for the *.mpr* files and trigger the merge from the Git command line (so the repository is put in the merge state for Studio Pro to be able to pick it up after the command is complete).
109
+
If you run this command from the command line with three *.mpr* files and the result has conflicts, you cannot resolve the conflicts in the `MINE` app using the `THEIRS` documents by opening the app in Studio Pro. Instead, configure Git to use `mx merge` as a [merge driver](#merge-git-driver) for the *.mpr* files and trigger the merge from the Git command line. This puts the repository in the merge state so Studio Pro can access it after the command completes.
108
110
109
111
{{% alert color="warning" %}}
110
-
`mx merge` as a [merge driver](#merge-git-driver) is suitable only for [MPRv1 Format](/refguide/troubleshoot-repository-size/#mpr-format)
112
+
Using `mx merge` as a [merge driver](#merge-git-driver) is suitable only for [MPRv1 Format](/refguide/troubleshoot-repository-size/#mpr-format).
111
113
{{% /alert %}}
112
114
113
115
### Examples
@@ -122,28 +124,28 @@ This table shows the return codes and their description:
122
124
123
125
| Return Code | Description |
124
126
| --- | --- |
125
-
|`0`| The merge is successful and there are no conflicts. *MINE.mpr* contains the result of the merge. |
127
+
|`0`| The merge is successful with no conflicts. *MINE.mpr* contains the merge result. |
126
128
|`2`| Conflicts are detected. Open *MINE.mpr* in Studio Pro to resolve them. |
127
-
|`4`| The version is unsupported. |
128
-
|`129`|There is an exception, an error occurred during the merge. Error details are printed in the command line output. |
129
+
|`4`| The version is not supported. |
130
+
|`129`|An error occurred during the merge. Error details are printed in the command line output. |
129
131
130
132
## mx merge as Git Merge Driver {#merge-git-driver}
131
133
132
134
{{% alert color="warning" %}}
133
-
`mx merge` as a [merge driver](#merge-git-driver) is suitable only for [MPRv1 Format](/refguide/troubleshoot-repository-size/#mpr-format)
135
+
Using `mx merge` as a [merge driver](#merge-git-driver) is suitable only for [MPRv1 Format](/refguide/troubleshoot-repository-size/#mpr-format).
134
136
{{% /alert %}}
135
137
136
138
{{% alert color="info" %}}
137
139
Studio Pro configures the merge driver for an app with the name **studiopro** when opening it in Studio Pro.
138
140
{{% /alert %}}
139
141
140
-
This section outlines the necessary configuration to enable the [mx merge](#merge) command as a merge driver in Git. With this configuration, you can merge one branch into another using third-party version control tools and the Git command line.
142
+
This section outlines the configuration needed to enable the [mx merge](#merge) command as a merge driver in Git. With this configuration, you can merge one branch into another using third-party version control tools and the Git command line.
141
143
142
-
Normally, when you are merging branches with Git, it compares the file changes in both branches. If a certain file has been changed in both branches, this triggers a conflict. If conflicting files are text files, Git attempts to resolve it automatically (very often successfully).
144
+
When you merge branches with Git, it compares the file changes in both branches. If a file changed in both branches, this triggers a conflict. If conflicting files are text files, Git attempts to resolve the conflict automatically and often succeeds.
143
145
144
-
However, if the conflicting files are Mendix apps, the conflict occurs in two .mpr files. Both the files and the conflict itself are more complex, which is why Studio Pro is needed to resolve them.
146
+
However, if the conflicting files are Mendix apps, the conflict occurs in two *.mpr* files. Both the files and the conflict itself are more complex, so you need Studio Pro to resolve them.
145
147
146
-
For such cases, Git provides an option to delegate conflict resolution for specific file types to an external tool. The `mx merge` command is designed to work with this mechanism, allowing Git to attempt merging the *.mpr* files as Studio Pro would. If conflicts remain, you can open Studio Pro and resolve them manually.
148
+
Git provides an option to delegate conflict resolution for specific file types to an external tool. The `mx merge` command works with this mechanism, allowing Git to attempt merging the *.mpr* files as Studio Pro would. If conflicts remain, you can open Studio Pro and resolve them manually.
147
149
148
150
### config File {#merge-config}
149
151
@@ -201,11 +203,11 @@ CONFLICT (content): Merge conflict in MyBlankApp.mpr
201
203
Automatic merge failed; fix conflicts and then commit the result.
202
204
```
203
205
204
-
Now, if you open you app on the **Main** branch, you should see the following:
206
+
Now, if you open your app on the **Main** branch, you should see the following:
205
207
206
-
* Both the **branch** and **main** microflows (this is a non-conflicting change, so `mx merge`sorted this out automatically, just like Studio Pro would do)
207
-
* A conflict on the **Home_Web** page concerning the renaming of home page caption (this is a conflicting change, as you changed the same caption to different values on both branches, so you can resolve this manually)
208
+
* Both the **branch** and **main** microflows. This is a non-conflicting change, so `mx merge`resolved this automatically, just as Studio Pro would.
209
+
* A conflict on the **Home_Web** page concerning the home page caption. This is a conflicting change because you changed the same caption to different values on both branches. You can resolve this manually.
208
210
209
211
{{% alert color="info" %}}
210
-
When you get a different output, the custom merge drive is not configured correctly. Abort the merge using the command `$git merge --abort` and close the Git command line tool before making changes to the configuration. Changes made to the configuration *config* and *.gitattributes* files are picked up by reopening the Git command line tool.
212
+
If you get different output, the custom merge driver is not configured correctly. Abort the merge using the command `$git merge --abort` and close the Git command line tool before making changes to the configuration. Changes made to the *config* and *.gitattributes* files are picked up when you reopen the Git command line tool.
0 commit comments