Skip to content

Commit c61101a

Browse files
Merge pull request mendix#9050 from tknippenberg/RevertCommit
Clarified 'revert' behavior for committed/uncommitted work
2 parents a0384f0 + 5e83822 commit c61101a

4 files changed

Lines changed: 34 additions & 16 deletions

File tree

content/en/docs/refguide/modeling/menus/version-control-menu/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ The **Merge Changes Here** option allows you to merge changes that were committe
4949

5050
## Revert a Commit
5151

52-
The **Revert a Commit** option allows locally rolling back changes that were committed to the version control repository. These local changes can then be committed as a new revision.
52+
The **Reverse Merge Changes** option allows you to locally [roll back changes](/refguide/using-version-control-in-studio-pro/#revert-changes) that were committed to the version control repository. These local changes can then be committed as a new revision.
5353

5454
## Revert All Changes {#revert-all-changes}
5555

56-
The **Revert All Changes** option allows rolling back all local changes, both in the app and in files on disk, that have been introduced since the last commit.
56+
The **Revert All Changes** option allows you to [roll back all local changes](/refguide/using-version-control-in-studio-pro/#revert-changes), both in the project and in files on disk, that have been introduced since the last commit.
5757

5858
## Optimize Storage Repository {#optimize-storage}
5959

content/en/docs/refguide/version-control/using-version-control-in-studio-pro/_index.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,44 @@ Select a revision to see additional details, such as related stories, changed do
201201

202202
## Reverting Changes {#revert-changes}
203203

204-
Changes that have not yet been committed can be reverted. Say, for example, that you have made a lot of changes to a page and you are not happy with the result. You can revert the page to the original state, that is, the state of the page before you started making changes.
204+
In case you want to undo changes that have been made, it is important to understand the difference between uncommitted changes, and committed changes that have been pushed to the server. Uncommitted work can simply be reverted, while committed work requires a new **Reverse commit** to undo.
205205

206-
Deletes of documents, folders, and modules can also be reverted. This brings them back into the app. Note that you will get back the latest version you have committed. For example, if you commit, make some changes to a microflow, and then delete the microflow, reverting the delete gives you the microflow without the changes that you made.
206+
### Reverting Uncommitted Changes
207+
208+
Changes that have not yet been committed can be reverted. For example, that you have made a lot of changes to a page and you are not happy with the result. You can revert the page to the original state, that is, the state of the page before you started making changes.
209+
210+
Deletes of documents, folders, and modules can also be reverted. This brings them back into the app. Note that you will get back the latest version you have committed. For example, if you commit, make some changes to a microflow, and then delete the microflow, reverting the delete restores the microflow without the changes that you made.
207211

208212
You can revert changes in the **Changes** pane, from **Version Control** > **Revert All Changes**, or from the right-click menu on the document you want to revert.
209213

210214
{{< figure src="/attachments/refguide/version-control/using-version-control-in-studio-pro/revertx2.png" alt="Two ways of reverting" class="no-border" >}}
211215

216+
{{% alert color="info" %}}
217+
You can also **Revert All Changes** while [merging](#merge). This will restore your app to the most recent commit, discarding changes creating by the merging process.
218+
{{% /alert %}}
219+
220+
### Reverting a Previous Commit
221+
222+
Changes that have been committed and pushed to the server can never be deleted from the history. However, you can make another commit to revert the changes. This is called **Reverse commit** in Studio Pro.
223+
224+
Select the **Version Control** menu > **Revert a Commit...** to revert a commit. This will create original changes "in reverse", which you can commit and push to the server.
225+
226+
{{% alert color="warning" %}}
227+
Reverting a commit creates a new commit that undoes the changes introduced by the original commit. This may lead to unexpected results depending on the context of the original commit.
228+
* **Port fix and reverting** – If you used [Port Fix](/refguide/merge-dialog/#port-fix) to apply a commit from another branch to the current branch, and then you revert that commit, the changes from the cherry-pick will not be reapplied when merging the full branch. This happens because the revert commit explicitly negates the cherry-picked changes, and Git recognizes them as already addressed.
229+
* **Merging and reverting** – If you [merged another branch](/refguide/version-control/#merging-branches) into the current branch and then reverted the merge commit, merging the same branch again will not reapply its changes. Git identifies that the merge was undone and prevents those changes from being reapplied.
230+
{{% /alert %}}
231+
232+
Reverting changes is done with one commit at a time. If you want to revert multiple commits, you can do that by reverting the latest commit, then the previous one, etc, one by one.
233+
234+
{{< figure src="/attachments/refguide/version-control/using-version-control-in-studio-pro/revert-changes-git.png" class="no-border" >}}
235+
236+
#### Reverse Merging
237+
238+
You can also revert a commit where another branch was merged into the current branch. Reverting a merge removes the changes introduced by that merge, making it appear as if they never happened. For example, if the merge added a new page, reverting it will remove the page locally.
239+
240+
Just like with a normal merge, conflicts can occur when reverting a merge. For example, if later commits change the new page, the reverse merge will result in a conflict. Once you resolved the conflict, you can commit the changes and push them to the remote repository.
241+
212242
## Dealing With Conflicts {#conflicts}
213243

214244
If you update/pull your app and the changes cannot be merged automatically, you will receive a message telling you that there are conflicts. A conflict arises when two changes cannot be combined.
@@ -276,18 +306,6 @@ Merging is always done while you have a working copy open. The merge will result
276306

277307
Select **Version Control** > **Merge Changes Here**, after that you can select **Port fix** or **Merge feature branch** options. For more information on merge settings, see [Merge Dialog](/refguide/merge-dialog/).
278308

279-
#### Reverting a Commit
280-
281-
[Reverting changes](#revert-changes) works for changes that have not been committed yet. Changes that have been committed and pushed to the server can never be deleted from the history. However, you can make another commit to revert the changes. This feature is called **Reverse commit** in Studio Pro.
282-
283-
Choose the **Version Control** menu > **Revert a Commit...** to revert a commit.
284-
285-
Reverting changes is done with one commit at a time. If you want to revert multiple commits, you can do that by reverting the latest commit, then the previous one, only one by one.
286-
287-
{{< figure src="/attachments/refguide/version-control/using-version-control-in-studio-pro/revert-changes-git.png" class="no-border" >}}
288-
289-
After a reverse merge the app will look like the changes never happened; if you reverse merge adding a new page, the page will be deleted locally. Just like when you are doing a normal merge, conflicts can arise. For example, if later commits change the new page, the reverse merge will result in a conflict. After resolving the conflict, you can commit and push the results to the remote repository.
290-
291309
#### Replacing the Main Line with a Branch Line
292310

293311
There are two methods for fully replacing your main line with a branch line.
7.05 KB
Loading
1.91 KB
Loading

0 commit comments

Comments
 (0)