How do I restore a deleted, source controlled file from SimulinkProject?

7 visualizzazioni (ultimi 30 giorni)
I deleted a source controlled file from my simulinkproject but I changed my mind and want it back. How can I do that from Simulinkproject?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 10 Nov 2025
Modificato: MathWorks Support Team il 10 Nov 2025
If you did not commit after deleting, you can restore the file by selecting "Revert to HEAD" in the Manage Branches window.
If you committed after deleting the file the process is more complicated.​ The process is to find the commit before the one where your file got deleted, and revert to that. Generally, to make this easier, it's best practice to commit often and note in the commit log whenever you delete or add a file. 
See also our documentation page here: 

To Retrieve a Deleted File From SVN

Click the "Revert Project" button.
In the window that pops up, find the revision where your file was deleted. Either the log messages or the "Modified Files" section should list what files are deleted in each revision.
Select the revision before the one where your file was deleted (in the above example that's revision 2). Then select "Revert". Your file is now available.

To Retrieve a Deleted File From git

1) Use the "Manage Branches" tool to see the log messages:
2) Find the commit before the one where the file was deleted, then select it and note the commit revision number:
3) Open up a git shell, in Windows with command line git by right clicking the folder in explorer and selecting "Git Bash", or 
in Unix by opening a terminal and changing directory to your sandbox folder.Run the command:
git checkout REVISION_NUMBER FILENAME
where REVISION_NUMBER is the revision number found in step 2, and FILENAME is the name of the file that got deleted.

Più risposte (0)

Categorie

Scopri di più su Source Control in Help Center e File Exchange

Prodotti


Release

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by