Sync the current file between a Visual Studio Code workspace and a ServiceNow instance
Identify conflicting files and merge or overwrite the changes, between the current file in your Visual Studio Code workspace and your instance.
Before you begin
Role required: admin
Procedure
- Click the Sync icon
Image omitted: vscode-sync-current-file.png
Sync current file icon from the menu on the top-right corner of the Visual Studio Code IDE.
Sync current file icon from the menu on the top-right corner of the Visual Studio Code IDE.
You can also use a keyboard shortcut Control+Shift+P in Windows and Command+Shift+P in MacOS to open the command palette and choose **Now: Sync Current File** from the list.
- If the changes occur either on the server or on the client, the extension synchronizes the file successfully without showing up any errors.
- If there are no differences between the local and server versions, then the message **No changes detected** appears on the bottom of the page.
- If the same file is modified both on the client and the server, then the system displays the conflicts in a **Conflicting Files** dialog box.
If a conflict list is displayed in a Conflicting Files dialog box, check the conflicts.
- Compare the Server and Client version using the Diff window, and evaluate the changes.
- Override the Server or Client changes.
Image omitted: vscode-conflict-changes.png
Conflicting Files changes list
Conflicting Files changes list
- Check for the differences in the Conflicting Files list.
Image omitted: vscode-opendiff.png
Conflicting changes display
Conflicting changes display
A dialog box displays the following options:
- Open Diff: Check for the differences between two versions and make the necessary changes.
- Mark Resolved: Resolve the differences and sync the versions.
- Overwrite Server: Choose if you want to override the server version with the client version.
- Overwrite Local: Choose **Override Local** to override the local version with the server version.
Click Open Diff.
You can see two versions of the file with the differences highlighted.
Image omitted: vscode-differences-sync.png
Window showing differences between client and server
Window showing differences between client and server
Make changes to the server version from the client version and save the file.
Click Mark as Resolved under Conflicting Files.
The changes are successfully synchronized upon the next synchronization. When the changes are merged successfully, the message Sync completed successfully appears at the bottom of the page.
Parent Topic:Synchronization between Visual Studio Code and a ServiceNow instance