Posted in Azure Data Studio, Source Control

Azure Data Studio – Multiple Repos and Explorer

If you read my T-SQL Tuesday post from this month, I mentioned that I’ve been using Azure Data Studio on daily basis. One of the things that I find I use it for the most is for Source Control with Git. I’m incredibly surprised by this. Maybe it comes from years of using Management Studio and not being able to check in code from the tool that I’m using to write it. (Or maybe I’ve been able to do that all this time and no one told me…?)

As I’m using it, I found two things that have helped me out. So naturally, I thought I’d share.

Multiple Repos

The most useful piece of functionality that I’m taking advantage of right now is working with multiple repos at the same time from within Azure Data Studio.

What I had been doing is opening the single repo folder when in Azure Data Studio. (File -> Open Folder -> \GitRepo\SQL_Presentations) Here you can see that I’m in the repo, by looking at the title bar of ADS.

Azure Data Studio window on the Source Control page. There is a red circle at the top that shows the name of the repo next to Azure Data Studio.
Notice the red circle around the name of the single repo on the top.

But I’ve also created a repository for scripts that I’m using in blog posts. If I want to make changes there using this setup, I would then have to open that folder. This means that I would have to close any open file that I have. So if I was in the middle of working on a script for SQL Presentations, I would have to stop what I’m doing, save and close the file, so I could do a change for the other repo.

That’s a bit of pain if you are constantly working from multiple repos. But you don’t have to do that.

I have set up my directories so that all of my repos are in the same folder, GitRepo. If I open the parent directory, GitRepo, ADS will recognize that I have 2 repositories:

Azure Data Studio Source Control view with two repositories opened. The names are circled in red.
Notice the red circles under Source Control highlighting the two repos that are in this folder.

From here, I can still do the various Git actions I need to do for each repo without disrupting any other work I have for other projects. The other nice thing is that I can easily see what branch I’m in by looking to the right of the folder name. The asterisk by the branch name means that there are changes locally.

Explorer

Another area of Azure Data Studio I’ve been using more is the Explorer. This is where you can get a list of all the open windows as well as all of the files in the folder you have open. If you create a new file and you realize you need to rename it, you can do that here. You can open files for editing as well as see if there are files that have been checked and have been modified or added. For the record, I haven’t yet tested deleting or renaming a file that’s been checked in. I know Git is pretty specific about how you do those actions but since I can have ADS open File Explorer, I can just jump there and use TortoiseGit to make those changes and go back to ADS for check-in.

Since the Explorer shows you all files, and not just those that have been added to source control, you can work with those files and then switch to Source Control to check those in. Now that I see what’s there, it’s been pretty a useful tool as I’m working with files. And because it uses the same directory as the folder that I’ve opened, I can again use this for all the files across the multiple repos as needed.

A close up view of the folder containing my two repos. Folders with changes have different colors depending on the changes. And it shows everything in the folder - not just the files that were checked in.
A close up view of the folder containing my two repos. Folders with changes have different colors depending on the changes. And it shows everything in the folder – not just the files that were checked in.
The right-click menu with the options for files. I probably use the Rename option the most, to be honest.
The right-click menu with the options for files. I probably use the Rename option the most, to be honest.

These are just two small details with ADS that I found pretty useful to my productivity so I thought I’d share them with you in the hopes that they help you too. Sometimes it’s the little things that make a big difference.

One thought on “Azure Data Studio – Multiple Repos and Explorer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s