Revert Changes

Discard Local Changes

With SVN, if you want to roll back local changes in a particular file, in a project, right-click the file and select Source Control > Discard Local Changes and Release Locks to release locks and revert to the version in the last sandbox update (that is, the last version you synchronized or retrieved from the repository).

In the Simulink® Editor, if an open model belongs to a project under source control, you can revert changes by selecting File > Project > Discard Local Changes and Release Locks.

To abandon all local changes, in a project select all the files in the Modified files list, then right-click and select Discard Local Changes and Release Locks.

With Git™, right-click a file and select Source Control > Revert Local Changes. Git does not have locks. To remove all local changes, click Branches in the Git pane and click Revert to Head.

Revert a File to a Specified Revision

  1. Right-click a file and select Source Control > Revert using SVN or Source Control > Revert using Git.

  2. In the Revert Files dialog box, choose a revision to revert to. Select a revision to view information about the change such as the author, date, log message.

    With SVN, select a revision and you can browse the lower list of files in the change set. Right-click a file in the list to view changes or save revisions.

  3. Click Revert.

    The project reverts the selected file.

  4. If you revert a file to an earlier revision and then make changes, you cannot commit the file until you resolve the conflict with the repository history.

    With SVN, if you try to commit the file, you see a message that it is out of date. Before you can commit the file, you must update its revision up to the current HEAD revision. click Update in the source control section on the Project tab.

    The project marks the file as conflicted because you have made changes to an earlier version of the file than the version in the repository.

  5. With either SVN or Git, to examine conflicts, right-click and select View Conflicts.

    Decide how to resolve the conflict or to keep your changes to the reverted file. See Resolve Conflicts.

  6. After you have resolved the conflict, mark the conflict resolved, either by using the merge tool or manually by right-clicking the file and selecting Source Control > Mark Conflict Resolved.

  7. Select the Modified (number of files) view to check changes, and on the Project tab, click Commit.

Revert the Project to a Specified Revision

With SVN, inspect the project revision information by clicking Show Log in the in Source Control section on the Project tab. In the Log dialog box, each revision in the list is a change set of modified files. Select a revision to view information about the change such as the author, date, log message and the list of modified files.

To revert the project:

  1. On the Project tab, in the Source Control section, click Revert Project.

  2. In the Revert Files dialog box, choose a revision to revert to.

    Each revision in the list is a change set of modified files. Select a revision to view information about the change such as the author, date, and the log message.

    With SVN, select a revision and you can browse the lower list of files in the change set. Right-click a file in the list to view changes or save revisions.

  3. Click Revert.

    The project displays progress messages in the SVN pane as it restores the project to the state it was in when the selected revision was committed. Depending on the change set you selected, all files do not necessarily have a particular revision number or matching revision numbers. For example, if you revert a project to revision 20, all files will show their revision numbers when revision 20 was committed (20 or lower).

With Git, you can switch branches. See Branch and Merge Files with Git.

Related Topics