My SQL Prompt GitHub Repo

I work for Redgate and write about products. I’ve got a series of SQL Prompt posts here on little things I like. SQL Prompt might be my favorite tool.  SQL Prompt will be yours as well if you give it a try.

Last year I published an article on SQLServerCentral from Guarav Vohra on using SQL Prompt with a VCS. I really like the article, and had been meaning to get my own SQL Prompt Snippet library into a repo, but kept putting it off.

If you don’t have a SQL Prompt library, download an eval and give it a try. It’s a fantastic tool and worth your boss buying since it will save you time when coding.

Finally this year, as I was setting up my 4th new machine in less than a year, and probably my 10th VM with SQL Prompt, I decided to just get myself set up to collaborate with myself. I don’t really have a team for development work now, but I do work across 3 physical machines weekly and perhaps 3-4 VMs as well.

Here’s how I got my snippets into a repo. First, get the folder where your snippets are stored. Since I’m on Prompt 7.3x, my system might look slightly different. If you open the Snippet Manager, you should see something similar to this:

2016-10-03 11_30_24-SQL Prompt – Options

The important part is the folder. I copied this path and pasted it into a command prompt. In this folder, I then ran a “git init” to create the repo.

2016-10-03 10_07_44-cmd

Once that was done, you can see I did a “git add –all” to add all the existing files and folders. I then made an initial commit, with a basic comment.

That committed all my current snippets to the repo. However, this is a local repo. This doesn’t help me with sharing across machines. The next step is to get up a repo somewhere I can access when I’m on another machine.

I chose GitHub since I put lots of work stuff there. I could have done BitBucket, set up my own Git server, etc., but this was simple. I created a new repo on Github.com and then got this:

2016-10-03 10_08_25-way0utwest_SQLPromptSnippets

This image appears as one of the options when you create a new repo. I could have cloned this empty repo to my machine, but since I’d already set on up, I wanted to push to github.

I used this code, and authenticated, to push my code. You can see the push below.

2016-10-03 10_07_55-cmd

Now, all my snippets are up on Github.

2016-10-03 10_10_55-way0utwest_SQLPromptSnippets_ Personal SQL Prompt Snippets

That has my snippets saved off to the cloud. I tested this by adding a new snippet and then from the command line doing:

git add –all

git push

And my code moved to GitHub.

The next post will look at pulling this code down to another machine with SQL Prompt.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , , . Bookmark the permalink.

One Response to My SQL Prompt GitHub Repo

  1. rsterbal says:

    This was a very demonstration of the challenges and solutions in a multiple computer environment.

Comments are closed.

%d bloggers like this: