How to revert using Git on Simulink UI?

22 views (last 30 days)
I want to revert the entire Simulink Project to a specific revision. How can I do this using Git source control on the Simulink Project UI?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Nov 2023
Edited: MathWorks Support Team on 20 Dec 2023
It is not currently possible to create an inverse commit from project history directly from the Simulink Project UI.  As a workaround, do the following:
1) Open the git branch manager, find the ID of the commit that you want to revert to, and note that down.
2) Close the project.
3) In MATLAB Command Window, reset the HEAD to the second revision:
!git reset --hard [commitID]
At this point, the HEAD and the "master branch should be at the same location.
4) Create and add a new script into the project.
5) Open Simulink Project and click Commit. 
At the end of this, you should be able to see in the Simulink Project > Branches window similar to the attached file: 
In general, MATLAB path will prevent any source control tool from deleting folders that are on the path. MATLAB's git integration can work around this issue, but command line git might cause problems. If reverting the project will not involve folder deletion, then the project can be kept open (neglecting step 2 from above).
  1 Comment
Felix Mireisz
Felix Mireisz on 15 May 2023
Hey everyone,
is there in 2023 a solution in MATLAB implemented which makes this possible with the Simulink Project UI?

Sign in to comment.

More Answers (0)

Categories

Find more on Project Management in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!