Key points
A Databricks Git Folder is a workspace folder that maintains a one-to-one mapping with a clone of a remote Git repository.
Each Git Folder records the remote URL, the currently checked-out branch or tag, the latest synced commit SHA, and the credentials used to authenticate against the provider.
The workspace stores those values per folder, which means two Git Folders pointing at the same repository can sit on different branches simultaneously, supporting the common pattern of one folder pinned to main for production runs and a second folder kept on a feature branch for development.
The problem this solves is the friction of moving notebook and configuration code out of the workspace, into a local IDE, through Git, and back.
Without Git Folders, a data engineer would export notebooks as .py source files, commit them locally, push, and re-import after merge.
Git Folders collapse that round trip: the workspace itself becomes a working tree, and the editor inside the workspace edits files that are tracked exactly the way they would be on a developer laptop.
Notebooks are stored as .ipynb or as source-format .py files with # Databricks notebook source headers, so the same file opens cleanly in a local VS Code session and in the workspace notebook editor.
Git Folders also act as the source-of-truth location that other Databricks features point at.
- A Lakeflow Job task can target a notebook inside a Git Folder pinned to a specific branch or commit, so the job runs the exact code at that ref without first synchronizing it into the workspace.
- A Declarative Automation Bundle can be deployed straight out of a Git Folder during development, then promoted through CI from the same repository.
- The folder is the bridge between interactive workspace editing and reproducible, version-pinned automation.
Creating a Git Folder and connecting a remote
A Git Folder is created from the workspace sidebar under Workspace, then Create, then Git folder. The dialog asks for the remote Git repository URL (HTTPS or SSH), the Git provider type, an optional Git Folder name, and an optional default branch.
The provider type matters because Databricks routes API calls (used for pull request creation, branch listing, and the like) through provider-specific endpoints; supported providers include GitHub, GitHub Enterprise, GitLab, GitLab Self-Managed, Bitbucket Cloud, Bitbucket Server, Azure DevOps Services, and AWS CodeCommit.
Credentials are configured once per user in User Settings under Linked accounts.
The recommended pattern is a personal access token (PAT) scoped to the minimum repositories needed; for organizations using fine-grained tokens, the token must include read and write access for contents, pull requests, and workflows.
Service principals can also be linked to Git credentials so that automated runs deploy from a non-human identity.
# Example: create a Git Folder programmatically via Databricks CLI
databricks repos create \
--url https://github.com/acme/lakehouse-pipelines.git \
--provider gitHub \
--path /Workspace/Repos/team-data-eng/lakehouse-pipelines
Once attached, the workspace fetches the default branch into the folder. The Git Folder UI shows a small icon next to the folder name with the current branch and any pending local changes.
Branching: create, switch, and protect
Branches in Git Folders behave the way they do anywhere else, with one important workspace-specific behavior: switching branches rewrites the files inside the workspace folder.
Any uncommitted local change must be either committed, stashed by saving and starring as a draft, or discarded before the branch switch proceeds.
The Git Folder UI surfaces dirty files in a side panel and refuses the switch until the working tree is clean.
Steps
To create a branch, open the Git dialog from the folder name in the breadcrumb.
The dialog lists local and remote branches, a Create branch input, and a button to switch.
A new branch is created from the currently checked-out commit, so the typical flow is to:
- first pull
main - then create
feature/silver-orders-dedupfrom it - then start editing
💡 Exam Trap: Creating a branch in the Git Folder dialog creates it locally inside the folder but does not push it to the remote. The branch exists on the remote only after the first commit and push, or after explicitly clicking the push button in the dialog. If a reviewer cannot see the branch in GitHub, the most common cause is that the branch was created but never pushed.
The provider can enforce branch protection rules independently of the Git Folder. A repository configured with branch protection on main will reject direct pushes from the Git Folder dialog the same way it would reject them from a local terminal, returning the provider's error to the workspace. Databricks does not weaken or bypass provider-side protection rules; it simply forwards them.
⚠️ Anti-Pattern: Treating the production Git Folder as an editing surface. The Git Folder that production jobs read from should be pinned to a tag or specific commit and treated as read-only. Edits should happen in a separate Git Folder on a feature branch. Editing files in the production folder bypasses pull request review and risks accidental commits to
main.
Committing and pushing
The Git dialog stages files in the same way git add does at the command line, but with a workspace-aware diff viewer.
Changed files are listed with their status (modified, added, deleted, renamed), and clicking a file shows a side-by-side notebook-aware diff.
For .ipynb notebooks, the diff strips cell outputs by default so reviews focus on code and Markdown rather than transient execution results.
For source-format .py notebooks, the diff is a plain text diff.
The commit message field is the standard short summary plus optional body.
Once authored, the Commit and push button performs the equivalent of git commit followed by git push origin <current_branch>.
If a push is rejected because the remote has moved ahead, the dialog offers a pull (fast-forward) and a retry.
Force pushes are not exposed through the UI; they must be done from a local clone or through the provider.
# Equivalent CLI flow for the same operations
databricks workspace export --format SOURCE \
/Workspace/Repos/team-data-eng/lakehouse-pipelines/notebooks/silver_orders.py \
./silver_orders.py
# Edit locally
git add silver_orders.py
git commit -m "silver_orders: deduplicate on order_id, sale_dt"
git push origin feature/silver-orders-dedup
📊 Limit: A single Git operation in a Git Folder is bounded by the provider's API limits, not by Databricks. GitHub, for example, limits a single push to 2 GB and rejects individual files larger than 100 MB. Notebooks rarely approach these limits, but a Git Folder used to carry large fixtures or sample data will hit them quickly. Use Unity Catalog Volumes for large binary assets instead.
Pulling and resolving conflicts
A pull is performed from the same dialog and behaves as a fetch plus fast-forward merge.
If the remote contains commits the local folder does not, and the local folder has no unpushed commits, the pull succeeds with a fast-forward.
If both sides have diverged, Databricks surfaces a merge conflict.
Conflicts are resolved by editing the conflicted file in place; for notebooks, the conflict markers appear inside the source representation.
A user must save the resolved file, then commit and push the resolution.
For long-running feature branches, the recommended practice is to pull from main into the feature branch frequently.
This keeps the conflict surface small and avoids the situation where a stale feature branch silently overwrites work merged to main while the developer was away.
💡 Exam Trap: Merge conflict resolution inside a Git Folder happens in the file content, not in a special UI. A notebook with a conflict will show standard Git conflict markers (
<<<<<<<,=======,>>>>>>>) inside the cell source. Forgetting to remove those markers before committing yields a syntactically broken notebook that will fail at first execution.
Creating pull requests via Databricks Git integration
How it works
Databricks does not host pull requests; it routes the user to the provider with a pre-filled PR creation page.
After a successful push of a feature branch, the Git dialog shows a Create pull request button.
Clicking it opens a new browser tab at the provider's compare view with the source branch (the feature branch) and target branch (the default branch or the configured base) preselected.
The user fills in the PR title and description and submits through the provider's UI.
The PR review, approval, and merge happen entirely on the provider's side. This separation is intentional.
Pull requests are a code review and policy enforcement surface that the Git provider owns, and integrating with the provider means features like required reviewers, status checks from CI, code owners, and merge queues all keep working without Databricks-specific configuration. The workspace's only contribution is the deep link.
# Typical end-to-end flow
1. Open Git Folder on main, click Pull to sync.
2. Open Git dialog, type "feature/silver-orders-dedup", click Create.
3. Edit notebook silver_orders.py inside the folder.
4. Open Git dialog, stage changes, write commit message, click Commit and push.
5. Click "Create pull request" - browser opens GitHub PR compare page.
6. Reviewer approves on GitHub; merge runs CI status checks.
7. After merge, switch the dev Git Folder back to main and Pull.
🎯 Scenario: A data engineer is iterating on a silver-layer cleaning notebook. They open the team Git Folder, which is sitting on
main, and click Create branch with the namefeature/clean-orders. They edit two notebooks, run them against dev data, and use Commit and push to land three commits. They click Create pull request, the GitHub compare page opens, they request reviewers, and CI runsdatabricks bundle validateagainst the PR head. A reviewer requests a change; the engineer edits the notebook again, commits and pushes a fourth commit, and the PR updates automatically. The reviewer approves and merges; production deployment is then driven by CI from the mergedmainbranch through Declarative Automation Bundles, not by editing the production folder.
Limits and quotas around Git Folders
Limits and quotas
There are a few documented limits worth tracking.
- A Git Folder can contain up to 20,000 files visible to the workspace, with files larger than 10 MB hidden by default in the workspace UI.
- A single workspace can host up to 5,000 Git Folders.
The Git operations themselves are constrained by the provider's API rate limits, which means a CI job that creates and tears down hundreds of Git Folders per hour can run into provider throttling rather than Databricks throttling.
📊 Limit: Per Databricks documentation, a Git Folder file count above 20,000 is unsupported and a single tracked file above 10 MB will not be displayed in the workspace tree (though it still exists on disk). Plan large repositories so that Databricks-relevant code lives in a subdirectory and the workspace clones only that subdirectory using sparse checkout if needed.
⚠️ Anti-Pattern: Storing data fixtures, model weights, or sample CSVs inside a Git Folder. These artifacts blow past file size limits, slow down clone and pull operations, and clutter diffs. Keep them in a Unity Catalog Volume or an external location and reference them by path in the code.
Decision Anchor
When to use
Choose Databricks Git Folders for interactive development when engineers need to edit notebooks live against workspace clusters and want commits and pushes without leaving the browser.
Choose a local IDE with the Databricks extension (or the Databricks CLI's sync command) when the editing experience or local tooling (linters, test runners, type checkers) is the primary need, and let the workspace pull the merged code through CI-driven bundle deployment rather than interactive Git Folder edits. ---
