dbt Cloud is a powerful tool for analysts transitioning to an engineering-like role, after all dbt Labs popularized the termn analytics engineer. One of the strong product features of dbt Cloud is how it makes version control as accessible as possible. In particular this blog refers to using the Cloud IDE.
If you need guidance on repository setup checkout the companion blog to this one here (link to be added in future).
![](https://www.thedataschool.co.uk/content/images/2025/01/image-236.png)
The following blog uses screenshots from dbt Cloud and replicating version control situations you will encounter using dbt and how its interface simplifies the version control actions required. With Learngitbranching I am able to replicate the situations with git commands and then explain what dbt Cloud is doing. Ultimately the fact that dbt Cloud makes the version control system more accessible and guided is excellent but it is still important to understand what occurs under the hood which is what this blog hopes to achieve.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-237.png)
Breaking down the Version Control Menu
![](https://www.thedataschool.co.uk/content/images/2025/01/image-225.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-228.png)
The button is going to be the most used functionality of the version control menu, it contextually updates based on the relevant version control action to take and we go under the hood of some of these in the next section.
Change branch in the dropdown is your git checkout <branch_name>
option. We breakdown what the revert button does and does not do later in the blog. Refresh git state is an option to pull new and updated branches from remote branch to your local branch which is why it is common for a pull option from main down to local branch to become available after selecting this. It is checking for changes in branches in remote and how this relates to the local branch.
Git Branch
![](https://www.thedataschool.co.uk/content/images/2025/01/image-209.png)
If you are on a protected main branch (indicated with the padlock), dbt Cloud suggests creating a branch as the main option in the version control menu:
![](https://www.thedataschool.co.uk/content/images/2025/01/image-216.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-218.png)
Note the change branch option in the top right of the initial screenshot is the equivilent of a git checkout branch_name
. Allowing the developer to switch which branch they are currently working on.
Git Commit
![](https://www.thedataschool.co.uk/content/images/2025/01/image-231.png)
Once a developer makes changes in a branch within the Cloud IDE, they will be encouraged to commit those changes (included in this action is a push to remote. It is also worth noting that the Cloud IDE is going to handily colour code changes (additions, alterations and removals) as well as grey out items that are in the .gitignore and are not tracked by git.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-217.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-219.png)
Git Pull
If your dev branch is behind the protected main branch it will prompt you to pull those changes down from Main:
![](https://www.thedataschool.co.uk/content/images/2025/01/image-241.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-221.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-220.png)
Pulling the latest version of Main to your development branch might cause conflicts - here the x indicates a conflict, we can opt not to resolve which is in practice a rollback to before the pull from main - the version control button ends up back at Pull from main.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-240.png)
You could resolve these conflicts on the repo platform of your choice, I find dbt Cloud's built-in solution to work well and save the hassle of leaving the Cloud IDE.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-242.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-243.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-245.png)
In order to resilve the above code I am going to opt to remove what I have in my dev branch and keep what I pulled from main, but I could also have the two conflicting lines of code (as they were on the same line when I pulled from main and both cannot be true at the same time) on back to back lines and that would have resolved the conflict.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-244.png)
Raise Merge Request (Gain approval for Git Merge)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-222.png)
![](https://www.thedataschool.co.uk/content/images/2025/01/image-223.png)
On a managed repository you cannot raise a merge/pull request you simply merge to main. In production a merge request is preferable to allow for a review of code and review process before merging development code to the main code base.
With a repostiory backed by GitHub/GitLab the version control option to merge is to raise a merge request in that external software, where the merge is then conducted.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-246.png)
Within GitHub/GitLab you might have approval requirements before you are presented with the option to merge
![](https://www.thedataschool.co.uk/content/images/2025/01/image-247.png)
You can also delete the branch after a completed merge that helps keep the project well managed and not sprawling with unused branches.
Once the branch is removed from the repository system it can be removed from dbt Cloud locally with the Prune Branches option in the dropdown where you will be warned which branches are to be pruned.
![](https://www.thedataschool.co.uk/content/images/2025/01/image-248.png)
Revert Git Changes
In dbt Cloud we have the option to revert changes:
![](https://www.thedataschool.co.uk/content/images/2025/01/image-251.png)
The documentation does not explain this action but I do not think it is backed by the git revert
which creates a ew commit that inverses changes specified as no commit occurs when selecting this button. It appear to serve the same purpose as the rollback to remote option when selecting the ...
in the bottom right of the IDE.
This button rolls back the local repository to the most recent version of the remote repository recloning it and restarting the IDE loading up the clone of the remote repo. The revert changes does not include a reclone and restart and seems to just delete all the changes made since the last commit locally (without reference to the remote repository).
Ultimately these two serve a similar objective in reverting back to the most recent commit. Any further rollbacks to particular commits for example should be conducted within the remote repository software.
Conclusion
We covered a lot of ground in this blog with the goal of illustrating the strengths of dbt Cloud in guiding a newer user through version control and making it accessible whilst also explaining what is going on under the interface. Keep an eye out for the partner blog in this series to follow on the different repository options.