Dev4Snow

Go back to ContentsGo back to previous page

Source Control / Git

The Source Control feature allows tracking database changes in a Git Repository. Dev4Snow currently supports connecting a single Git Repository per Snowflake system –and per Windows login account.

To configure Source Control click the Source Control icon ( ) from the SQL Tab and select Manage Source Control, which opens this window:

You can start either by clicking Clone Remote Repository, or by clicking Initialize Local Repository.

 

Clone Remote Repository

When you click Clone Remote Repository you will get this message:

If you fill the Remote Git Repository URL (for example with repo “https://github.com/mygitrepos/snowdb.git”) and click Clone Remote Repository again you will get this message:

The remote Git repository was cloned to a local Git repository along will all of its contents. You can use the button “Open in File Explorer” to check the local contents. After cloning a remote repository the status message –in blue- will change to reflect the new state:

Now you can start using it. If you want to -or need to- create a second branch to publish your new scripts you can do it by using the button “Create branch…”. Once the branch is created you can use the combo box to select it and then click “Connect Branch to Remote Repo” to indicate that you want to publish from this new local branch to the remote repository.

 

Initialize Local Repository

When you click Initialize Local Repository you will get this message:

A full-featured local Git repo was initialized. You can start using it just as a local repository, or you could also connect it to a remote repository by clicking “Connect Branch to Remote Repo”. Connecting the local repo to a remote repo is not mandatory and it can be done at any moment.

If you fill the “Remote Git repository URL” and then click “Connect Branch to Remote Repo” you will be able to publish to the remote Git repository, but it may be possible that you cannot merge the contents to the master/main branch –since it’s not sharing the same history. It is always convenient to start by cloning a remote repository if your plan is to publish to it.

 

Commit changes to repository

When working in a SQL Code Window you can publish your new scripts either automatically –by clicking the open lock icon ( )- which will start tracking the DDL that you run and including it in the configure Git repo, or manually by selecting the code -DDL or DML- and right-clicking > option “Add selected statements to Git Repo”. The branch that is selected as “Current branch” is the one receiving the changes.

To commit the changes to the local repository just return to Manage Source Control, click the button “Commit Changes” and enter a message for the commit.

If your branch is connected to a remote repository you can click “Sync to Remote Repository” when you are ready to upload all the commits that you have created.

 

Using Git command line interface

Since the Git created by Dev4Snow is a full-featured Git repository, you can manually run Git commands by using the Git CLI.

In Source Control window Click the “Open in CMD” button which opens CMD in the Git repository folder, or use the SQL Window menu icon ( ), option “Open Git Folder in CMD” to run Git commands –it requires Git CLI to be installed. You can download Git CLI from this website:  https://git-scm.com/download/win