The Art of SQL Server Database Administration, Development, and Career Skills for the Technically Minded
In the previous post we talked about using the template explorer within SSMS to keep a sane TSQL library. People have complained for some time that the template explorer within SSMS is too limited for use as a true team based script repository. You cannot change where SSMS stores these scripts and as this storage area is local to where you have installed a single version of SSMS this limits it’s use for teams as well as for folks who have more than one work station or more than one version of SSMS installed on a single workstation.
Enter GIT. This is a real game changer for the folks, like me, who still really like using the template feature for managing my scripts. Not necessarily because GIT is terribly revolutionary. Subversion and other source control solutions are also folder based, but because it has a wide support base across users and because of the cloud.
GIT is an increasingly popular option for source control. When combined with GITHUB this becomes not only a elegant and simple source control tool, but also creates a excellent tool for team collaboration and a repository for documents, scripts, and code alike.
As stated GIT is a folder based source control system, which lines up nicely with the folder structure used by the template explorer. To turn the local template folder that we created in the last post into a source controlled local repository, all we have to do it commit via GIT. Then, to turn it into a shareable and collaborative team based repository we can publish to GITHUB.
TechNet documentation on templates identifies the local folder where templates are stored. https://technet.microsoft.com/en-us/library/ms174169(v=sql.120).aspx. There is nothing special going on in this folder. It is literally just as it appears in the template explorer. Which, luckily for us makes it perfect for GIT – a folder based source control option.
Once I’ve located the template folder I want to turn into a repository I simply use any of the GIT based tools – the command line, the GITHUB GUI, or whatever my chosen option is to create my repository.
With this repository I can now collaborate with team mates, I can also share my own repository across my various devices or environments. As I’ve already taken the step to ensure that my scripts are tested to coincide with each version of SQL Server, I will now create a dedicated repository for each install of SSMS (if I have more than one). Or, I can just as easily save them all in the same repository across all my installs if I so choose.
Your task now is to get familiar with GIT. There is some decent tutorials right on GITHUB – keep in mind however that GIT and GITHUB are not synonyms. GITHUB is a internet based repository that leverages GIT. GIT is folder based distributed source control system whose software and source code is open source and has a much wider usage than just within GITHUB.
If you are interested in the technologies running this solution I would recommend getting familiar with GIT first. You can start with GIT right on the project web site at http://git-scm.com/. Once you are familiar with the basic workings of GIT you can then start using GITHUB as a shareable repository hosting location.
On the other hand, if you just want to get up and running with a shareable, updateable, track-able, repository and don’t really care about the underlying mechanics. You can jump right in and learn more as your needs demand.
However you go about learning GIT, the reality remains, it’s a great option for managing your SSMS template based TSQL library. When combined with GITHUB – it solves pretty much all the problems that have held the template explorer approach to your TSQL library back.
I hate to say it, but it’s this reason that my own open source project, the DBA Toolbox, hasn’t really been developed much past my first couple compilations. I like this other solution too much.