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

7 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2025-11-10
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Source Control 的更多信息

产品


版本

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by