Sub topic 3
Committing, Pushing, and Pulling Databricks Git Folder Changes
Assume you know basic Git commands, can use the Databricks workspace, and have connected a supported Git provider. A Git folder is a workspace folder linked to a remote repository.
Commit, push, and pull
Edit notebooks or files in a feature branch. Review the diff, commit related changes, and push the branch for review.
git checkout -b feature/clean-orders
git add -A
git commit -m "Clean orders notebook"
git push -u origin feature/clean-orders
git pull --rebase origin mainIn Databricks, these actions are also available from the Git dialog. Pull before starting work so your branch contains recent changes.
Resolve merge conflicts
A conflict occurs when Git cannot safely combine edits to the same lines. Pulling or merging marks the file with conflict markers:
<<<<<<< HEAD
total = subtotal + tax
=======
total = subtotal + shipping
>>>>>>> origin/mainChoose the intended code, remove all markers, test the notebook, then stage and commit the resolution.
Share files and Python modules
Store reusable Python code in .py files beside notebooks. Import it with a normal Python import when the Git folder is on the Python path.
# helpers.py
def clean_order_id(value: str) -> str:
return value.strip().upper()
# notebook cell
from helpers import clean_order_id
print(clean_order_id(" a-17 "))Keep notebooks focused on orchestration and place tested transformations in modules.
Permissions and limits
Git folders need repository access and workspace permissions. Users may be unable to clone, change credentials, or push to protected branches. Large generated files, secrets, and unsupported workspace objects do not belong in Git. Store secrets in a secret manager, not in notebooks or commits.
Run jobs from Git
A job can define its notebook task from a Git repository. Select the repository URL, provider, path, and branch, tag, or commit. Pin production runs to a reviewed commit when reproducibility matters.
CI/CD and Asset Bundles
Continuous integration and continuous delivery (CI/CD) can run tests on pull requests and deploy approved resources. Databricks Asset Bundles describe notebooks, jobs, and environments as configuration, so a pipeline can validate and deploy them consistently.
A team workflow that works
- Use one feature branch per change.
- Pull or rebase before opening a review.
- Keep commits small and messages specific.
- Test modules and parameterized notebooks before merging.
- Protect the main branch and deploy from reviewed revisions.
Exercise
Why should a production job use a reviewed commit instead of an active feature branch?
Show answer
A commit identifies an exact, reviewed version, while a feature branch can change between job runs.