Search code examples
openwrt

uci - how to revert all unstaged changes


uci documentation says:

All "uci set", "uci add", "uci rename" and "uci delete" commands are staged into a temporary location and written to flash at once with "uci commit".

If I get it right, you first run some commands like the ones mentioned above and to make the changes be written to the configuration files you run uci commit. For example, let's say I have done the following changes...

root@OpenWrt:~# uci changes
network.vlan15.ifname='eth1.15'
network.vlan15.type='bridge'
network.vlan15.proto='static'
network.vlan15.netmask='255.255.255.0'
network.vlan15.ipaddr='192.168.10.0'

...but I don't want to continue and commit them. Is there an easy way to revert all staged changes and avoid doing it one by one?


Solution

  • There is a command to revert all staged changes

    revert  <config>[.<section>[.<option>]]     Revert the given option, section or configuration file.
    

    So, in your case, it should be

    uci revert network.vlan15
    

    See https://openwrt.org/docs/guide-user/base-system/uci