# Revert

> Reverts the specified assets by undoing any changes done since the last time you synced.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.VersionControl](/engine/6000.7/script-reference/unityeditor/versioncontrol.md)
* **Assembly:** UnityEditor.CoreModule

## Revert(AssetList, RevertMode)

Reverts the specified assets by undoing any changes done since the last time you synced.

```csharp
public static Task Revert(AssetList assets, RevertMode mode)
```

### Parameters

**** (\[AssetList]\(/engine/6000.7/script-reference/unityeditor/versioncontrol/assetlist)): The list of assets to be reverted.**** (\[RevertMode]\(/engine/6000.7/script-reference/unityeditor/versioncontrol/revertmode)): How to revert the assets.

### Returns

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [Task](/engine/6000.7/script-reference/unityeditor/versioncontrol/task.md) |             |

### Remarks

The last sync time is usually when [Provider.GetLatest](/engine/6000.7/script-reference/unityeditor/versioncontrol/provider/getlatest.md) was last issued but may differ if an external version control client is used at the same time.

Note that after this operation is completed, Asset Database is not refreshed automatically. It can be updated by calling [AssetDatabase.Refresh](/engine/6000.7/script-reference/unityeditor/assetdatabase/refresh.md).

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour
{
    [MenuItem("Version Control/Revert")]
    public static void ExampleRevert()
    {
        AssetList assets = new AssetList();
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs"));
        Task t = Provider.Revert(assets, RevertMode.Normal);
        t.Wait();
    }
}
```

[Provider.Revert](/engine/6000.7/script-reference/unityeditor/versioncontrol/provider/revert.md) can be used with two different revert modes - normal and unchanged. The normal revert mode reverts all of the local changes made while the unchanged mode only reverts files that haven't been modified yet.

## Revert(Asset, RevertMode)

Reverts the specified assets by undoing any changes done since the last time you synced.

```csharp
public static Task Revert(Asset asset, RevertMode mode)
```

### Parameters

**** (\[Asset]\(/engine/6000.7/script-reference/unityeditor/versioncontrol/asset)): The asset to be reverted.**** (\[RevertMode]\(/engine/6000.7/script-reference/unityeditor/versioncontrol/revertmode)): How to revert the assets.

### Returns

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [Task](/engine/6000.7/script-reference/unityeditor/versioncontrol/task.md) |             |

### Remarks

The last sync time is usually when [Provider.GetLatest](/engine/6000.7/script-reference/unityeditor/versioncontrol/provider/getlatest.md) was last issued but may differ if an external version control client is used at the same time.

Note that after this operation is completed, Asset Database is not refreshed automatically. It can be updated by calling [AssetDatabase.Refresh](/engine/6000.7/script-reference/unityeditor/assetdatabase/refresh.md).

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour
{
    [MenuItem("Version Control/Revert")]
    public static void ExampleRevert()
    {
        AssetList assets = new AssetList();
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs"));
        Task t = Provider.Revert(assets, RevertMode.Normal);
        t.Wait();
    }
}
```

[Provider.Revert](/engine/6000.7/script-reference/unityeditor/versioncontrol/provider/revert.md) can be used with two different revert modes - normal and unchanged. The normal revert mode reverts all of the local changes made while the unchanged mode only reverts files that haven't been modified yet.
