Rajendra Gupta
Synchronization between Git and GitHub repositories

Integrating Azure Data Studio with Git and GitHub

July 3, 2020 by

In the last article, Source Control using Git in Azure Data Studio (ADS), we explored the following topics:

  • The requirement of Source control for SQL scripts
  • Git installation on Windows
  • Integrate Git in Azure Data Studio
  • Create Git repository, add SQL scripts, modify files, commit into source control
  • View different versions using the Git timelines

In this article, we will take a step forward and integrate Git installed locally on the GitHub.

First, it is essential to understand the difference between Git and GitHub terminology.

The difference in the Git and GitHub



Git version control is installed locally on your system.

In the previous article, we installed it locally and configured

It is a cloud-based hosting to store your scripts with different versions, repositories.

Git is primarily useful for version control and codeshare

It is a centralized source code sharing platform

It is an open-sourced licensed and provides a command-line interface

Github includes a free tier, pay as you go account as well. We get a graphical interface for GitHub

In Github, we have a centralized platform in which you can create repositories among users, and they can work on it simultaneously. By default, it provides public access for your repository, but you can modify it to a private mode as well

If your team has many developers, each of them needs to install Git software locally. You can push and pull changes from their systems, but it becomes slightly complicated as the number of users grows. In the following image, it shows two separate users with Git installed on their systems. Now, both users can push and pull their changes. Git demo

GitHub is a cloud-based web hosting repository. Users can connect to it and begin storing, retrieving the codes.

GitHub integration

Git and GitHub integration in Azure Data Studio

In the above section, we discussed the differences in Git and GitHub. You can integrate these two tools to utilize the benefits of both local resources as well as a cloud solution. You can create a free account in the GitHub and create the repository. Developers can clone their repository from the Git into the GitHub.

First, open the URL https://github.com/ and click on Sign Up.

GitHub URL

Provide the required inputs such as username, email address, password, and verify the account.

Enter the basic details

After you create a free GitHub account, create a repository name. By default, it is a public repository so everyone can see the repository, but as a repository owner, we can choose who can commit their changes.

Create a GitHub Repository

In the below screenshot, we see two parts for repository:

  • Owner: It is the user name we created during signup for the GitHub account
  • Repository Name: It is the folder created to store the code

GitHub Repository

Click on Create repository. It gives you a web URL that we use to integrate Git in Azure Data Studio with the GitHub.

It also gives you instructions to create the repository from the command line. We will explore the git command later.

Repository URL

Integrate GitHub and Git using Azure Data Studio

Now, launch the ADS and navigate to View-> Command Palette and look for the Git Add Remote.

Integrate GitHub and Git using Azure Data Studio

It opens a pop-up window that asks for the remote name. You can give it any user-friendly name. In the ADS output, you can view the Git commands it uses for its commands. For example, it uses git remote command for this purpose. You can also enable Git: Show Git Output to view git commands it executes in the background.

Remote name

After you specify a remote name, press enter, it asks for the URL. We need to specify the GitHub repository that we created earlier.

GitHub repository URL

We do not get any confirmation message that it added the remote URL. No error means everything is fine. However, you can view in the git output that it adds the URL we specified in the GUI.

Git remote command

Synchronization between Git and GitHub repositories

Now, let’s remove the earlier file and add a new SQL script without any version. You can follow the previous article and commit a SQL script. In the timeline, we can see that custom message specified by us.

Synchronization between Git and GitHub repositories

At this point, we have prepared the following things:

  • Added a GitHub remote URL in the Git configuration of Azure Data Studio
  • Created a SQL script and committed it in the source control

Now, we have the requirement to sync this local repository of Git into the remote repository of GitHub.

To do so, navigate to View-> Command Palette-> Git Sync.

Command Palette

It starts the synchronization process between the local repository and remote GitHub. We have not specified any explicit branch, so I use the master branch in the GitHub. Click on OK in the below action pop-up.

Click Ok

It uses a git pull command for the master branch. It also shows you the list of scripts that it starts synchronizing.

Git pull command

Now, refresh the web browser for GitHub. In my case, I have two repositories in GitHub. After the synchronization, you can see that Repository ‘RajendraScripts’ shows a t-SQL icon. It shows that this repository has got the SQL script.

Multiple repository

Open this repository, and it shows the SQL script file that we have in Git Source. It also shows the message we used that we specified during commit the script in the source control.

View script in GitHUb

Now, click on the file name to view the SQL script.

View script content

Can we edit the file in the GitHub and sync it back to the Git repository? Let’s check it out. Click on the highlighted edit icon in the above image to make changes in the code. It opens the script editor. In the below script, I added a few database names, as shown below.

Bidirectional sync

Scroll down the page, and you see a section for Commit changes. It automatically gives you a suggestion to put the comment. In my case, it shows comment as Update sys.databases.sql comment

I added the comment Update Script – Add Master, Model, and MSDB database. It suggests that the summary should be less than 50 characters. We can put the extra characters in the description field.

Commit message

Let’s modify the comment and put some details in the description box as shown below. Commit summary and description

For the commit, we got two options. We can either commit directly to the master branch or create a new branch for this commit in GitHub. Let’s go with the first option and commit to the master branch only.

Click on Commit Changes. It commits our script changes, and you can see the latest script version along with the script commit summary.

Commit Changes

Click on the history, and it gives you script versions to commit records. We can see it has two commits as of now.

  • The First commit – It synchronized the script from the Git repository
  • The second commit– We modified the script in the GitHub editor and committed it to the master branch

Script modify and commit

Now, switch to Azure Data Studio and sync the source control again using the Git sync option in the command palette. It reflects the script changes performed in the GitHub for the local repository as well. In the logs, you can see it performed the sync from the GitHub repository URL.

Azure Data Studio Git sync from GItHub

You can click on the script name in the GitHub folder, and it has the latest script.

Git timeline

Create a Script Version in the GitHub and sync in the Git repository of Azure Data Studio

Let’s create another version of the script. This time we will add an additional script (highlighted below) using the ADS Git repository.

Create a Script Version

We need to commit each time it needs to be saved into the source control. As we already know, it uses Git Commit to save changes in the script.

Git Commit

Give a suitable name for the commit. Ideally, this commit message should reflect the changes performed in a few words.

put commit message

You got the commit message in the Git timeline after the commit is done.

Git timeline

Perform manual sync between Git and GitHub repositories, and you can see the latest code being checked in.

View latest code

Click on the commit message. You can see the changes in a script in a friendly interactive editor. It shows the plus (+) symbol for the lines we added in the script. Similarly, if we remove any lines, you see it with a minus (-) symbol.

Plus and minus symbols

Comments on the GitHub commit

GitHub provides additional functionality for the users to put their comments on the scripts. Suppose your team member reviewed the script. He can put a comment on the script. Open the script version and put a comment on it, as shown below. Put a comment and click on the Comment on this commit.

Comments on the GitHub commit

It saves the comment for the corresponding commit, as shown below.

View comment

Other users can view the comment, reply to the comment, or use smileys as well. Click on the smiley icon and choose the appropriate smiley to showcase your reaction to the comment.

Pick your reaction

We see the reaction on the comment in the following image.

View reaction


In this article, we explored the integration of Git and GitHub repository with Azure Data Studio. GitHub is a web-based cloud hosting, and you can sync your local repositories into it. It is bidirectional sync that means you can modify the script either in Git or in GitHub console, and changes reflect in the other repository. We will explore more on the source control in Azure Data Studio in my upcoming articles. Stay tuned!

Table of contents

The SQL Server Assessment Extension for Azure Data Studio
Source Control using Git in Azure Data Studio (ADS)
Integrating Azure Data Studio with Git and GitHub
Working with Git components in Azure Data Studio

Rajendra Gupta