Working with Git
Only in DbVisualizer Pro
This feature is only available in the DbVisualizer Pro edition.
Using Git is a great option if you are looking to version control your scripts, but also to share your work with your team is a systematic and safe way. Version-controlled files are organised in repositories, and you can work with multiple repositories at the same time in DbVisualizer.
Adding a repository
To make your version-controlled repositories available in DbVisualizer, open the Git tab. If the repository already exists in a directory in your environment, you can mount it using the corresponding action in the toolbar.
If the repository hasn't been copied to your environment yet, you can clone it using a dedicated action in the toolbar. When cloning, you will need to provide the URI of the repository and choose a target directory.
Several authentication methods are supported including integrated GitHub authentication, username and password (that can also be used for personal access tokens), as well as SSH authentication.
Mounted repositories can be reordered using drag and drop.
To unmount a repository, right-click and choose the corresponding action. Please note that while this will remove the repository from DbVisualizer, the actual files will remain intact.
Making changes
When you add, remove or modify files in a repository, the list of the changed files will appear under the corresponding repository node in the Git tab.
To refresh the list of changes, right-click on the repository and choose Reload From Disk. To reload all repositories at once, you can use the reload action in the toolbar.
By default, the changed files are presented as a list. If you want to include the directory structure in the list of changes, you can change this using the View menu in the toolbar.
Screenshot: nested list of changes and the view menu.
Diff and rollback
To see the changes in a file, choose Show Diff in the context menu. This will open a diff view for the selected file, allowing you to examine the changes and make adjustments if necessary.
If you want to undo the changes in a file, choose Rollback in the context menu. This will revert the file to the state it was in when you last committed it. Choose the Delete locally added files from the file system option if you want to remove new files during rollback.
Commit and push
When you are happy with your changes, you can commit them using the Commit action. Choose the files you want to include, and write a commit message that will describe the changes in the repository's commit history. Press Commit to create a local commit, or Commit and Push if you want to publish the changes to the remote repository at once.
When you have local unpublished commits, an indicator will appear in the repository list. You can publish the changes using the Push action.
Screenshot: outgoing commits indicator and push dialog.
Fetching remote changes
From time to time, you will want to fetch changes from the remote. This can be done using the Pull action.
Resolving conflicts
If the are no local changes, this is a simple operation. However, if you have uncommitted changes or unpublished commits, there may be conflicts between your changes and the changes in the remote repository. In this case, you will need to resolve the conflicts by merging the local and the incoming changes.
If conflicts are detected during pull, and they can't be handled automatically, a dialog listing the conflicting files will be displayed. For each conflict, you can double-click to see the diff, choose Force Update to choose the incoming version or Keep Local to keep your changes instead.
Using branches
If you use branches in your workflow, you can switch between them using the Checkout Branch action. The list contains both local and remote branches. If you don't find the branch you are looking for, you can refresh the of branches from the remote in the same dialog.
To create a new branch, click Create Branch and choose a name for the new branch.
Browsing commit history
To examine the history of changes in a repository, choose Show Log, which will bring up the Git Log window. Here, you can choose among the existing branches add see the commit history of the selected branch, including the commit message, author, date, and any tags associated with the commit. For the selected commit, the list of changes and the full commit message are displayed on the right. Double-click on a change to see the corresponding diff.