The Agent Git plug-in allows you to seamlessly integrate Microsoft SSMS with Git. The plug-in has been tested SSMS 2014 versions however it should also work with earlier versions of the SSMS software.
Features of the plug-in include:
Described below are the steps required to get Agent Git to work with Microsoft SQL Server Management Studio 2014 and Git.
To use Agent Git with an earlier version of Microsoft SQL Server Management Studio just follow the similar steps using in that earlier version of the software.
From within the Microsoft SQL Server Management Studio IDE use the Tools, Options menu to bring up the Options dialog and in the Source Control section select Agent Git as the active provider as shown below:
Bring up the Agent Git configuration as shown below:
The resulting Agent Git configuration dialog is shown below:
You can use this dialog to configure the behaviour of the plug-in.
To see how Agent Git works we need something to play with so the next step is to create a simple test project.
From within Microsoft SQL Server Management Studio IDE create a new My Scripts project as shown below:
This will result in the following project binding dialog shown below:
This dialog takes two inputs, a project name and a local folder location that contains the Git repository.
In this particular case hitting the Ok button will result in the following dialog:
The reason the dialog is displayed is because we are dealing with a new project and no Git repository exists for the project and as such the response should be Yes.
However, for the case where the project already has a Git repo the answer should be No and the path should then be modified to point to that existing Git repo.
Create a few SQL Query files in the project folder with the end result being a project folder that looks something like this:
From inside the Microsoft SQL Server Management Studio IDE, add these SQL files to the project using the Solution Explorer and the end result should be a project that looks like this:
Notice that these newly added files have the plus sign on their icon, which indicates they have not yet been added to the Git repository.
Right click on the My Scripts project and use the check in option to complete the addition of these files as shown below:
That action will result in the check in dialog shown below:
After the check in is completed the icons of these files will change as shown below:
Use the repository browser to confirm the project files are now inside the source control repository as shown below:
With the project fully configured and bound to the repository, you can now use the check out, check in, revert, file compare commands (or any of the other source control commands) to manage your SQL file.
You can also use the View History option to track and compare file changes as shown below: