Revert a commit

0
 Hi..   I want to revert 5commits that i have done, How can i do in Mendix- 10.18.7 Example - Lets say the available committed version is 0 and on top of it i made 5 commits - 1,2,3,4,5 respectively! Now how to revert all the 5 commit.   I'm using git respository based and this type repository mendix studio pro have only option as revert a commit. When i click on it - it is allowing me to select the version but failing in the process and when i retry - it reverts without asking me the version. So Im not sure to which version it is reverting!
asked
3 answers
0

You can create a new branch and while creating it, you can select whichever commit you would like to select as the revisioın. 

 

For example from main branch, you would like to go back to 5 commits earlier.

Version Control -> Manage branch lines -> New -> Revision (select the 5 steps earlier)

answered
0

You can follow the steps Tolga mentioned, but you can also use the “Revert a Commit” button in “Version Control.”

image.png

 

image.png

 

Using Revert a Commit, you specifically select the commit you want to revert, and the application will show it as Changes (reverting the changes made in the commit). After that, you can make a new commit, which will be responsible for reverting the changes made in the commit selected in the previous step.

answered
0

Well, I think you can do it via git itself. So inside your Mendix repository you can open a git terminal and try the following command to remove the latest 5 commits. 

 

git reset --hard HEAD~5

git reset: The command to move the branch pointer.

--hard: This option discards all changes in your files, matching them to the state of the commit you are resetting to. Any uncommitted work will be lost.

HEAD~5: This tells Git to go back 5 commits from the current one (HEAD).

Your local repository is now reset to the state it was in before those 5 commits (version "0" in your example).

answered