How to Set Up Version Control of Your SQL Server Database from Scratch

April 16th, 2021

Version-controlling SQL Server databases in GitHub has never been easier with Devart solutions. You can commit and revert changes, view and resolve conflicts, track changes and link static data with convenience. And such tools as dbForge Source Control will help you easily and effectively manage your GitHub repository.

But now let’s go back and see where it all begins. Let’s see how to create a new repo on GitHub and then clone it to your local computer.

Creating a New Repo on GitHub

Step 1. You need to create or sign in to your GitHub account. Once it is done, look at the upper-right corner of the page. You will see a + button. Click it to invoke the dropdown menu, then click New repository.

Step 2. Now you need to enter a name and, optionally, a description for your repo. Let’s name it, for instance, project-a.

Step 3. After that, select the required visibility: Public or Private (a third option, Internal, is available to enterprise accounts). Brief descriptions explain the differences between these options.

Step 4. Optionally, select Add a README file to initialize your repository. If required, you can also select Add .gitignore and specify a list of project files that will be ignored by Git. The third optional check box allows you to Choose a license for your project. Finally, click Create repository.

Please note that if any of the three checkboxes is selected, steps 9 and 10 will not be necessary later on.

That’s it! Now let’s clone the repo to your local computer.

Cloning Your New Repo to a Local Computer

Step 5. Create an empty folder on your computer. It will contain your local repo. Let’s name it D:\project-a to keep things simple.

Step 6. Launch your Command Prompt and proceed to your local folder. In our example, we enter D: and cd project-a.

Step 7. Copy the URL of the repo you have created on GitHub.

Step 8. Execute the git clone command for this URL. In order to clone the repo in the folder you have created (Step 5), make sure to place a dot at the end of the command, as shown on the screenshot below (otherwise, an unnecessary subfolder will be created).

If you have selected any of the three checkboxes (Step 4), skip Steps 9 and 10.

Step 9. Execute git commit --allow-empty -m initial.

Step 10. Execute git push.

Congratulations! Now you are prepared to start committing changes to your new repo. The most helpful assistant you can get here is dbForge Source Control, an SSMS add-in that helps to version-control SQL Server database schemas and data, roll back unwanted changes, and maintain the integrity of your databases.

Learn how to set up Source Control and work with multiple branches.

Download dbForge SQL Tools

Comments are closed.