Platform
Version control
Commits

Commits

Learn about how Knock's commit and promotion model works.

To version the content changes you make in your environments, Knock uses a commit model.

How commits work

#

When you make a change to a content resource (like a workflow or a layout) in the Knock dashboard, you need to commit it to your current environment before those changes will appear in workflows triggered via the API.

Commits can be promoted to higher environments, such as production, and they can also be rolled back to prior commits. Lastly, commits provide a comprehensive version history for all content resources in your account.

A few additional notes:

  • A commit is not a save. When you're drafting a workflow or a template, you can save and test your changes. Saved changes apply when you're using the test runner, but they do not apply to workflow runs or guide renders that are invoked via the API. To test changes via the API, you must commit them.
  • "Publish" in production = commit to production. If you're working directly in production, the "Publish" button is the same as the "Commit" button. You'll still get a commit history and be able to roll back to prior versions if needed.
  • Account-level resources are not version controlled. Channel configurations, branding, and variables do not need to be committed, as they live at the account-level. This means that if you make a change to a channel configuration, it will update immediately on notifications sent in that environment.
  • You can commit changes using our CLI and management API. We offer both a Management API and a command line interface for interacting with Knock resources programmatically, both of which support programmatic commits.

Visualizing commit changes

#

Clicking the "Commit to development" button will show you a view of changes between your current commit and the most recent version of the resource that you're updating. Commit diffs are also available on your full commit log (viewable on the "Commits" page in your dashboard), so you can view the commit history for a resource and know exactly what was changed with each commit.

Commit diffs in Knocks version control

Promoting commits

#

If you're working in a non-production environment such as development, you can promote your changes to the production environment when you're ready to go live.

You can promote your commits from a given resource's page. You can also view all commits in one place in the Commits page, where you can promote individual or multiple commits at once.

Learn more about promoting commits in our environments documentation.

Reverting a commit

#

If you've made a change in a commit that you want to revert, you can use the "Revert commit" feature to "undo" that change. You can find the revert commit action on the Commits page in the dashboard, under the "Unpromoted changes" and "Commit log" tabs.

Reverting a commit will:

  • Create a new commit with a message that indicates the commit reverts a preceding commit
  • Wind back the state of the resource to the change that precedes the commit
  • Undo any uncommitted changes on the resource

Because the revert will produce a new commit, you can then promote that commit to other environments to make that change live in those environments.