Reset to a Particular Commit with the Python Client

Assuming you have connected with the Python Client, created a database, and made a few commits, you can reset the HEAD of a database to a particular commit. Just like you would do in git with git reset.

Get the commits list

You can use the Python Client Library method to get a list of branch commits. This example uses pagination to get the last commits starting from the branch head -

//For TerminusCMS
from terminusdb_client import Client
client = Client('')
client.connect(team='MyTeam' db='your_db', api_token='YOUR_API_TOKEN_HERE')
commits = client.logs(count=10)
// For TerminusDB
from terminusdb_client import Client
client = Client('http://localhost:6363')
client.connect(key='root', user='root', team='root' db='your_db')
commits = client.logs(count=10)

A response example will be a list of objects like this:

"message":"create initial schema",

Reset to a specific commit

To reset the HEAD of your database to a particular commit, you need to get the identifier of a particular commit. To obtain the identifier, refer to the code snippet above.