Toad World® Forums

Using Git with URL instead of path?

Hi,

is there actual a way (or is this planned for future) to log into an Git repository using an internet location instead of a directory?

Best regards
Rainer

Hi Rainer,

Connecting to remote Git repositories is currently supported in Team Coding, yes; however because Git is a distributed version control provider, the connection and workflow are a bit different than centralized version control providers.

In a centralized version control (SVN, TFS, Perforce, etc), you connect directly to the remote server and checkout and checkin files directly from/to that server. During the typical workflow process, the version control provider will make local copies of the server's files on your machine; however, changes are made to the server directly, and the server maintains all version history of files and/or repository tree.

In a distributed version control (such as Git and Mercurial), you first clone the remote repository locally to your computer and then you work in your local copy of the repository. When you clone the remote repository, the version control client will create a link to the remote repository's master branch. You then need to manually pull changes that happen on the remote server and push your local changes to the remote server. A typical workflow for non-databases in Git would be:

  1. Clone the remote repository to your local drive (this happens only once)
  2. Create a local branch for your work task
  3. Make whatever changes you need to make
  4. Commit those changes to your local branch
  5. Switch to the master branch
  6. Pull changes from the remote master branch
  7. Switch back to your local branch
  8. Merge the changes from master into your local branch
  9. Push your local branch to the remote repository
  10. Create a pull request
  11. Merge the remote branch into the remote master once the pull request is approved

This allows you to work locally and make your own local changes without affecting anyone else on the team until you're ready to merge your changes into the master branch. You can even change directions and switch branches and the version control client will rebuild the local repository to match the code that is specifically in that branch.

This branch switching / rebuilding, however, is something that databases don't support. Databases, by their inherent nature, operate in a centralized fashion: the source is in a central place and shared between all team members involved. Changes one team member makes are directly reflected and live in the database for everyone. Having a user switch branches can't automatically rebuild source in the database since that would adversely affect the database code's functionality and impact other team members. Until the first team member pushes his/her changes and all other team members pull those changes, their repositories will be out of sync and they'd have no idea why database code is changing. The purpose of a distributed version control is to be able to work isolated from everyone else and only merge your changes in only when they're done; but with databases, you can't really work isolated.

As a result, Team Coding uses a modified workflow that doesn't necessarily include branching:

  1. Clone the remote repository to your local drive (this happens only once)
  2. Stay in a single branch for all team members (this could be "master" or a separate shared branch specified for database code)
  3. Make whatever changes you need to make
  4. Commit those changes to your local branch (check in objects)
  5. Pull changes from the remote branch
  6. Push your local branch to the remote repository

In Toad 13.0 and higher, you can clone a remote repository when you set up a new connection.
You can also manually clone a remote repository to your local machine using the Git command-line client. Once the remote repository is cloned locally, you would connect to your local repository and do your work in the local repository. From there, you can pull and push commits between the local and remote repository within Team Coding. You can still do branching if you so choose, but Toad lets that branching management to the user to handle manually.

image

Since centralized and distributed version control providers work differently, they need to be handled differently, but Toad will let you connect to and work with a remote repository.

I hope that helps to answer your question. If you have any additional questions, please feel free to let us know.

Thanks,

-John

1 Like

Hi John,

thanks for your quick and detailed answer. The way you describe is exactely how we already work.

The reason why I asked this question is another. For performance reasons it would be better for us to connect to a http git repositoy location instead of a local path / UNC path. This has to do with remote work (Corona...) and VPN. But I think with your answer I can convince our network specialists to do some research and eliminate the bottleneck in our equipment. It seems to be difficult, but they are the gurus :slight_smile:

Thanks again, have a good time and best regards
Rainer