Git folders
Databricks · Notebooks & Development
Theory
Git folders (formerly Repos) connect a folder in your workspace to a remote Git repository on GitHub, GitLab, Azure DevOps, Bitbucket and other providers. You clone a repository into the workspace, and the notebooks, Python files and other files in it behave like normal workspace files, but you can switch branches, pull, commit and push from the Git dialog inside Databricks.
To create one, go to Workspace, open Create → Git folder, paste the Git repository URL, pick the Git provider and click Create Git folder. The branch button next to a notebook's name opens the Git dialog, where you see changed files, write a commit message and click Commit & Push, or click Pull to get teammates' changes. For example, Ravi clones techtown-dbx, creates the branch feature/orders-merge, edits orders_etl and pushes; a pull request on GitHub then reviews the change before it reaches main.
Why we use it
Notebooks without version control get overwritten and are hard to review. Git folders bring branches, pull requests and CI/CD to Databricks code, so teams can collaborate safely and deploy the same code to dev and prod.
When to use it
Use a Git folder for any code you share or deploy. Each developer should work in their own Git folder and branch. For deploying jobs and pipelines, combine Git with Declarative Automation Bundles rather than editing production folders by hand.
How it works
- Workspace → Create → Git folder
- Paste the repository URL and click Create Git folder
- Create or switch to a feature branch
- Edit notebooks and files
- Ready to share the change? Yes: Commit & Push from the Git dialog. No: Keep editing; Pull to get others' work.
- Open a pull request in GitHub, GitLab or Azure DevOps
Syntax
Workspace → Create → Git folder → Git repository URL, Git provider, Git folder name → Create Git folder
Git dialog: branch button → Pull | Commit & Push | Create Branch
User menu → Settings → Linked accounts (Git credentials)Example
# Inside a Git folder, Python files can be imported directly
# Repo layout:
# techtown-dbx/
# src/transforms.py -> def add_gst(df): ...
# notebooks/orders_etl
from src.transforms import add_gst
orders = spark.read.table("main.sales.orders")
display(add_gst(orders))
# Then: branch button → review changes → message 'Add GST column' → Commit & PushKey points
- Git folders were called Repos; old docs and exam questions may still say Repos
- Set up Git credentials once under Settings → Linked accounts
- Commit & Push needs a commit message; Pull brings remote changes in
- Work on a feature branch and merge through a pull request in your Git provider
- Python files in a Git folder can be imported from notebooks in the same folder tree