# Revert Local Changes from command line?

**URL:** https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566
**Category:** Support
**Created:** [July 23, 2023, 12:41pm UTC](https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566 "2023-07-23T12:41:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ddrake](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/d/54ee81/32.png) [@ddrake](https://forum.syncthing.net/u/ddrake)
#### Post date: [July 23, 2023, 12:41pm UTC](https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566/1 "2023-07-23T12:41:17Z")

</div>

I have a headless device that I use to mirror some backups. It has a Receive Only folder and the syncing works as expected.

If that device somehow does get some changes – I accidentally delete or change something – I want the changes to get reverted from the authoritative source. I can do that with “Revert Local Changes” in the GUI, but this is a remote, headless machine and it would be far more convenient to be able to do that from the command line.

Is there a way to do this? I’d like both a way to detect when there are local changes, and then the corresponding command to revert them.

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [July 23, 2023, 12:52pm UTC](https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566/2 "2023-07-23T12:52:39Z")

</div>

You will need to use the REST API.

Please check:

- [https://docs.syncthing.net/dev/rest.html](https://docs.syncthing.net/dev/rest.html)
- [https://docs.syncthing.net/rest/db-revert-post.html](https://docs.syncthing.net/rest/db-revert-post.html)

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [July 23, 2023, 2:51pm UTC](https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566/3 "2023-07-23T14:51:14Z")

</div>

> <https://github.com/syncthing/syncthing/blob/main/cmd/syncthing/cli/operations.go#L41>

I think does what you want.

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [August 22, 2023, 2:51pm UTC](https://forum.syncthing.net/t/revert-local-changes-from-command-line/20566/4 "2023-08-22T14:51:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
