Other common use cases
This guide demonstrates various ways to leverage Git integration beyond just collaboration purposes.
Automatic backup of project
One common use case you might want to utilize the Git integration is a regular backup of your project.
Start by setting up a project integration for your hosting provider - GitHub or Bitbucket.
You have created a repository for your project.
Bitbucket
In case you have set up your repository with Bitbucket, you have to create a schedule for the CleverMapsToGit_master
workflow on the master
branch. See how you can create a schedule in Bitbucket.

Example of a daily schedule
Github
In case you have set up your repository with GitHub, the scheduling is done automatically. By default, it is set to run every 2 hours. Scheduling is defined in CleverMaps to Git - master
using cron syntax. See how you can set your own schedule.

Restoring a project backup
Before you can restore a project backup, you have to have Git integration set up for your project.
Reverting a commit in Git allows you to restore a previous state of your project, effectively serving as a way to restore a backup. It is a handy technique to undo changes and revert to a known good version of your project.
To revert a commit in Git, you can use the following command:
git revert <commit_hash>
Replace <commit_hash>
with the hash of the commit you want to revert. This will create a new commit that undoes the changes introduced by the specified commit, effectively reverting your project to the state before that commit was made.
To find <commit_hash>
, you can use the following command:
git log
This command will display a list of commits in reverse chronological order (newest to oldest). Each commit will have a unique hash associated with it, usually displayed as a long alphanumeric string (eg. 9c848cc72fa64d96dbb13ab43e4f9f0c99663a9b
)
Example of output:
commit 9c848cc72fa64d96dbb13ab43e4f9f0c99663a9b
Author: bitbucket-pipelines <bitbucket-pipelines@clevermaps.io>
Date: Wed Jul 26 09:04:34 2023 +0000
Automatic synchronization commit of master project on 2023-07-26:09:04:34UTC [skip ci]
commit 8a99c324eba148d587b48ce7ad703e4b8982d0fc
Author: bitbucket-pipelines <bitbucket-pipelines@clevermaps.io>
Date: Wed Jul 26 08:38:00 2023 +0000
Automatic synchronization commit of master project on 2023-07-26:08:38:00UTC [skip ci]
...
After reverting the commit, use git push
to push the changes to the repository. The Update master project from the main branch will trigger automatically and restore your project metadata to the state of the commit.
Reminder: Metadata removed in a repository is not removed in the project when running update project workflows. See logs of the workflow in the step Run replace content python script, which metadata files should be removed.
You can remove the metadata from the project using CleverMaps Shell or CleverMaps Studio.