Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 07:54 AM
Here is a version of @vr 's solution that can be run from any folder within the rep. It uses regex to extract the root from the path in the form of \Repos\<username>\<some-repo:
import os
import re
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
repo_root = re.search(r'\/Repos\/[^\/]+\/[^\/]+', os.getcwd()).group(0)
repo_info = next(w.repos.list(path_prefix=repo_root))
print(repo_info.head_commit_id)