Hard reset programatically

camilo_s
Databricks Partner

Is it possible to trigger a git reset --hard programatically?

I'm running a platform service where, as part of CI/CD, repos get deployed into the Databricks workspace. Normally, our developers work with upstream repos both from their local IDEs and from the Databricks Code Editor. It sometimes happens though that, due to their mixed (and sometimes inadequate) use of IDE and Databricks GUI, the repo deployment process fails during CICD (error code GIT_CONFLICT).

In that case, we'd like to catch this error and do a hard reset to overwrite the Databricks Repo with the status of the Upstream repo (which should be the single source of truth anyhow).

Is it possible to do this programmatically?