You are currently viewing the new Anvil Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the new Anvil Editor Docs main page

Version control

Anvil stores a version history for each app, meaning you can restore previous versions as well as publishing a particular version and working on another. See the Quickstart to see how.

The entire Anvil app consists of files in a Git repository, so you can work on your app locally and use Git to build custom workflows. (See Version Control:Git for more information.)

Version history in the Editor

At the bottom of the App Browser, you can open the Version History of your app.

The version history dialog shows you the history of your app. Each time you save a version, a new entry is made in this list. You can set a name for a version when you save, which makes it easier for you to remember it later. This name is a custom git commit message.

The Version History dialog. There is a tree of commits, one of which is published, There are buttons to save the current version, and to clone the app with Git.

‘Restore this version’ was clicked on the ‘Small Change’ commit.

You can go back to a previous version by clicking Restore this version. This lets you try changes, and then back them out if they don’t work.

In the image above, the Anvil developer has clicked on ‘Restore this version’ for the commit marked ‘Small Change’, and they can continue editing the app from there. New commits will be added on top of ‘Small Change’.

Published vs. Dev versions

You can publish a particular version of your app by clicking Publish in the Version History dialog:

The Version History dialog. You can publish a particular version by clicking 'publish'

Publishing a particular version of your app by clicking ‘publish’

This means that anyone who visits your app sees that version, whatever you’re doing in the editor. It lets you carry on working on an app even while other people are using it.

If you haven’t published a version of your app, then everyone sees the development version.

Once you’ve published a version, visitors to your app see the ‘Published’ version (both client and server code).

You can also click ‘Unpublish’ if you want to go back to having the published version the same as the development version.

To find out which version of your app is running in code, use anvil.app.branch. If you run the app in the Anvil Editor, anvil.app.branch will be "master"; if you have published a version of your app and you’re running that, it will be "published".

from anvil import *

if app.branch == 'published':
  print("We are on the published branch")

(In client code you automatically have from anvil import * so it’s available simply as app)


Do you still have questions?

Our Community Forum is full of helpful information and Anvil experts.