Git Refresher

Jun 24
Git in dbt Cloud: a practical refresher
dbt fundamentals · prerequisite reading

Git in dbt Cloud: a practical refresher

Before you write your first dbt model, here's the minimum Git knowledge you need - and exactly where to find it in dbt Cloud.

1

What is Git?

Git is a version control system - it keeps a full history of every change made to your code, who made it, and when. Think of it like tracked changes in Google Docs, but for SQL files.

In dbt Cloud, Git is built right in. You don't need to install anything or open a terminal. Every time you save and commit your work, dbt Cloud handles the Git operations for you behind the scenes.

📖

Full history

Every change is recorded. You can always see what changed, when, and why - and roll back if something goes wrong.

🤝

Team collaboration

Multiple people can work on the same project simultaneously without overwriting each other's work.

Why does this matter for dbt? Your dbt models are code files - SQL, YAML, and Markdown. Git makes sure no work is ever lost, all changes are tracked, and your team isn't stepping on each other's toes.
2

What is a branch?

Every dbt Cloud project is connected to a Git repository - a shared store of all your SQL models, tests, and docs. A branch is your personal copy of that repository where you can make changes without affecting anyone else.

🌿

Your personal branch

Where you build. Create one branch per piece of work - a new model, a bug fix, a refactor. Your changes stay here until you're ready to share.

🏠

The main branch

The source of truth. Your production dbt jobs run from main. Nobody edits it directly - changes arrive only after review and approval.

How it looks visually

main   ●────────────────────────────────●  ← production runs here

your branch    ●──●──●──●           ← you work here
               create  edit edit

You branch off main, do your work, then eventually merge back in. Production is never touched while you're working.

Creating a branch in dbt Cloud

  • 1In the dbt Cloud IDE, click the branch name in the top navigation bar (it shows main by default).
  • 2Click Create branch and give it a descriptive name. Use the format feature/what-youre-building - for example, feature/add-stg-orders.
  • 3The top bar updates to show your new branch name. You're now working in your own isolated copy.
Naming tip Good branch names tell a story: feature/stg-customers-dedupe is clearer than my-branch or fix1. Your teammates will thank you at review time.
Note for this course We've already created a personal branch for you - no need to create one from scratch. To switch to it: click the down arrow next to the branch name → Change branch → select the branch that matches your name in the format firstinitiallastname (e.g. jsmith for Jane Smith). Always make sure you're on your personal branch before you start editing.
3

Commit and sync

Once you've written or edited a model, dbt Cloud needs you to do two things: commit (save a snapshot of your changes) and sync (upload that snapshot so the team can see it). In dbt Cloud, both happen with one button.

📸

Commit

A named snapshot of your changes at a point in time. Like a save point in a game - you can always go back to it.

☁️

Sync

Uploads your commit to GitHub/GitLab so your instructor and teammates can see your work.

In dbt Cloud, you never type git commit or git push. Instead, look for the Commit and sync button - it does both in one click.

  • 1After editing or creating a file, the Commit and sync button becomes active in the top bar.
  • 2Click it. A dialog appears listing the files you changed. Review them - make sure nothing unexpected is included.
  • 3Write a commit message that describes what changed and why. Then click Commit and sync to confirm.

What makes a good commit message

  • Be specific: add stg_orders with order_date filter beats changes or wip
  • Use present tense: fix null handling in revenue model, not fixed
  • One thing per commit: if your message needs "and" more than once, consider splitting it into two commits
⚠️ Don't forget to commit before switching branches If you switch to a different branch with unsaved changes, dbt Cloud will warn you. Always commit your work before switching - otherwise you risk losing it.
This setup is only needed if you want to do the MCP bonus task in Lab 12. Feel free to skip this for now and come back to it later. 👋
Download and install Claude Desktop from claude.ai/download and sign in with your account.
That's it for the optional prep! The actual MCP server configuration is covered in Lab 12 Bonus.