Skip to main content

How do I use Git or version control with Databricks?

Summary

  • Databricks Git folders are a visual Git client and API inside the workspace. You clone a remote repository, then branch, commit, push, pull, merge, rebase and resolve conflicts on notebooks and files.
  • Connect your Git provider first: under Settings > Linked accounts, add a Git credential with OAuth or a personal access token. Git folders work with GitHub, GitLab, Azure DevOps, Bitbucket and AWS CodeCommit, in cloud and self-managed editions.
  • Use Git folders for interactive development. For CI/CD and production deployments, the docs point to Declarative Automation Bundles with versioned artifacts and workload identity federation.
  • Git CLI access for Git folders, in Public Preview, adds standard Git commands such as git rebase -i, submodules and pre-commit hooks from a notebook, the web terminal, Genie Code or the SSH tunnel.

How do I use Git or version control with Databricks?

Connect your Git provider, clone your repository into a Databricks Git folder, and work on your own branch: edit notebooks and files, commit, push, and open pull requests with your Git provider as usual. Then make deployment come from Git, not from anyone's workspace folder. Databricks recommends Declarative Automation Bundles for CI/CD, so the repository holds both your code and the definitions of the jobs and pipelines that run it.

What can you version on Databricks?

Git folders support version control for specific Databricks asset types:

Asset Status in Git folders
Files (code, libraries, images) Supported
Notebooks (.ipynb, or .py with a # Databricks notebook source marker) Supported
Folders Supported
SQL queries saved as .dbquery.ipynb (new SQL editor) Public Preview
AI/BI dashboard drafts saved as .lvdash.json Public Preview; publishing and scheduling aren't tracked
Alerts saved as .dbalert.json Public Preview; cloned alerts start paused
Legacy alerts, MLflow experiments, Genie Agents Not supported

Set up Git folders

  1. Add a Git credential. Click your username, select Settings > Linked accounts > Add Git credential, pick your provider, and link with OAuth or paste a personal access token. You can store several credentials, with one default per provider.
  2. Clone the repository. In Workspace, browse to a folder where you have CAN MANAGE, click Create > Git folder, and enter the repository URL, provider and folder name. Turn on sparse checkout to clone only some directories of a large repository.
  3. Branch and commit. Create a feature branch in the Git folders UI, make your edits, then commit and push. Databricks recommends that each developer work on their own branch.
  4. Review and merge. Open a pull request with your Git provider. Merge, rebase, reset and conflict resolution are also available from the Git dialog.

Supported cloud providers include GitHub and GitHub Enterprise Cloud, Bitbucket Cloud, GitLab, Azure DevOps (Azure Repos) and AWS CodeCommit. Self-managed options include GitHub Enterprise Server, Bitbucket Server and Data Center, GitLab Self-Managed and Azure DevOps Server. For a Git server that isn't reachable from the internet, you install a proxy inside your VPN for Git authentication requests.

Key practices for version control on a data platform

Practice Why it matters
Version control almost everything Notebooks, .py and .sql files and bundle YAML belong in Git, so the repository describes the whole project
Keep secrets and build output out Don't commit tokens, PII or .jar and .whl files; upload compiled binaries to Unity Catalog volumes during CI
Use one repository and trunk-based branching Short-lived feature branches keep main deployable and reduce merge conflicts
Keep business logic out of notebooks Importable .py modules and .sql files are easier to test and reuse
Point production jobs at Git For staging and production, configure job tasks to reference a remote Git repository, not a workspace path

How Databricks approaches Git beyond the UI

Git CLI access (Public Preview). Git folders created with Git CLI access let you run any Git command, including git stash, git push --force and git rebase -i. You can also use submodules and Large File Storage, add pre-commit hooks for linting and code scanning, and work with repositories that exceed the limits of standard Git folders. Run the commands from a notebook, the web terminal, Genie Code, or an IDE connected over the SSH tunnel (Beta). Workspace admins control access from the Previews page.
Git with Lakeflow Jobs. Notebook, Python script, SQL file and dbt project tasks can check out code directly from a remote repository. Databricks takes a snapshot of the branch, tag or commit when a run begins, so every task uses the same version, and the run details show the commit SHA.
Bundles and CI/CD. Declarative Automation Bundles put job, pipeline and dashboard definitions in the same repository as the code they run, and CI deploys them with the Databricks CLI. For a code-only setup, an admin can keep a production Git folder on a deployment branch that automation updates when pull requests merge.
See Databricks Git folders, Create and manage Git folders and CI/CD with Databricks Git folders.

FAQs

Are Git folders the same as Repos?

Yes. Repos are now called Git folders. The core functionality is the same, and Git folders can sit at any level of the workspace file tree.

Can I version control AI/BI dashboards?

Yes, in Public Preview. Git folders save dashboard drafts as .lvdash.json files, but publishing and scheduling configurations aren't tracked. Bundles can also deploy dashboards across environments.

Should my production jobs run from a Git folder?

Databricks recommends referencing workspace paths in Git folders only for rapid iteration and testing during development. For staging and production, reference a remote Git repository or deploy with bundles.

What if my repository is too large for a Git folder?

Use sparse checkout to clone only the directories you need, or Git CLI commands. Databricks recommends against Git folders backed by large monorepos.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.