Setting up the Source control wizard for a Git repository

Applies to
ApexSQL Build, ApexSQL Data Diff, ApexSQL Diff, ApexSQL Script, ApexSQL Source Control

Summary
This article explains how to set up the Source control wizard for the Git repository in ApexSQL applications.

Description

A prerequisite for setting up the Source control wizard in ApexSQL application is creating a repository on one of the hosting services. Check out how to create the Git repository on Bitbucket.org.

Once everything is set on the Git hosting service side and the repository path is obtained, ApexSQL application is ready to be connected to the newly created Git repository.

In this article, ApexSQL Script will be used as an ApexSQL application in which the Source control wizard will be set up and explained:

  1. In order to get to the Source control setup wizard in ApexSQL Script, follow the steps from 1 to 10 in How to automate batch SQL object scripting and committing to source control.

  2. Once the Source control setup wizard is initiated, In the System selection tab, choose the Git source control system from the drop-down list, and click the Next button:

  3. In the System login tab, the following needs to be entered:

    • Username and Password – provide the same credentials that were previously created for the hosting service (Bitbucket in this case)

    • Repository – full url that leads to the repository on the hosting service

      For Bitbucket, it looks like this: https://bitbucket.org/account_name/repository_name (in case of using the https protocol)

    • Branch – allows the creation of a new instance of the code base containing all changes up to now, with the addition of currently uploaded changes. The Branch option is available only for Git source control system. Find out more about this in Creating branches and committing to specific branches

      Quick tip icon

      Quick tip:

      Branching is particularly useful for projects maintained by a group of people where everyone can have their own “private” space for development of individual code, and merging them into a main branch upon finish

    • Folder – allows the user to set the committing process to the root of the repository or to create new projects under the same repository:

      Quick tip icon

      Quick tip:

      Instead of creating repositories for each specific project, create several projects under the same repository and have all source control projects in one place

      Creating a new project under the same repository:

      1. Click the Folder button located next to Folder field and the Choose project window will pop-up

      2. Click the New Project button in the bottom-left corner of the window:

      3. In the new window, provide a project name (a comment is not mandatory) and click the OK button to confirm:

      4. Once the new project is created, select it, and click the OK button:

      5. Notice that the Folder field is now filled, containing a newly created project path:

    After the system login information has been entered, click the Test button in order to test the connection between ApexSQL Script and the Git hosting service. If the connection is successful, a popup window with the “Test succeeded” message will be shown:

    If the connection test was not successful an appropriate message will be shown. For example, if a wrong username/password has been entered, the following message will be shown:

  4. After the connection was successfully tested, click the Finish button in the bottom-right corner to complete the Source control setup wizard and to load source control settings in ApexSQL Script:

Q: Can I use labels for committing/pulling changes in ApexSQL applications?

A: Yes. Labels are available in all ApexSQL applications that support source control and you can read more about this in the How to work with source control labels article.

Q: Can I commit static data using ApexSQL applications?

A: Yes. Static data can be committed using ApexSQL Script, ApexSQL Source Control, and ApexSQL Data Diff as well.

Q: Which source control systems are supported in ApexSQL applications?

A: ApexSQL source control applications support Git, Mercurial, Perforce, Subversion and Team Foundation Server source control systems.

Q: How can I commit changes to another branch and not the master branch?

A: When setting up the Source control wizard, click the Refresh button next to the Branch filed, and from the drop-down list choose the desired branch:

Once the desired branch is selected, all committed changes will go to the selected branch.

Q: Can I create new projects under a different branch and are those projects visible when another branch is selected?

A: New projects can be created under any branch and those projects will be visible only when that particular branch is selected.

Q: Is it safe to create a sub-project on the repository and will the changes be committed to that particular sub-project.

A: Yes, it is safe to create a sub-project without worrying about affecting the parent project when committing changes.

Q: Is it possible to check for new changes on the repository without having to restart the application in order to connect to the latest repository version?

A: Yes. Depending on the ApexSQL application, the Refresh button is available in different places, but once clicked, it will get the latest from the source control repository.