Version control: Get started with Git, remote repositories and RAD Studio XE8

by May 19, 2015

In one of the latest surveys among RAD Studio developers, we realized that there is still a significant part of the community that doesn’t use any version control system, a surprising 32%.

There are many reasons to use a version control system, no matter if you're a single developer working in a small project or if you're a large team working in a big one. So, if you still haven't started using a version control system, why don't give it a try and take profit on the enhancements added in RAD Studio XE8 related to this.

 

 

For this blog post I'm going to pick Git (the most popular source control system among developers in Stack Overflow according to their 2015 Developer Survey). I’m going to use Bitbucket (a cloud-based service) to host the remote repository for a project that I have in my local computer. There are many online remote repositories ready to use, and, of course, you can also install your own Git server from scratch or try a turnkey solution ready to deploy.

After creating a new account on the site (if you haven't one already), the first thing to do is to create the repository for the project.

Once, it's created, you will get some steps on how to set up the directory that actually holds the un-versioned project.

As I haven't installed Git in my brand new Windows 10 installation, now it's the perfect time to do it (btw, I'm really impressed on how cool RAD Studio XE8 looks in Windows 10).

Now, let's apply those set up steps into our project folder (whit a bit of fine-tuning for a Delphi project). You can right-click on the project's root folder to start the Git Bash.

Now your project is versioned using Git and cloned in the remote repository.

Let's take a look now on how to use the Git capabilities right from the RAD Studio IDE.

Setting up the IDE to use Git is quite simple, it's only needed to specify where the Git executable is located in the Options window (under Version Control).

Now, opening the project, we have enabled in the IDE the Git capabilities. It's possible to commit the changes done in all the files of the project or a specific file (of group of files). For this example I've added a button to clear 4 edit components, and then I'm going to commit the changes done in the whole project, from the context menu found in the project name in the project manager.

Then the Commit window shows the files to be committed, and there are some actions that can be invoked from here, like showing the changes done to any file.

After the Commit is completed, the IDE shows us a message confirming the result.

To make the changes committed in our local repository to be uploaded to the repository server, it's needed to perform the push action. Again, this is very easy to do, just right clicking the project name in the project manager and click the push action.

The first time we connect to the remote repository, the RAD Studio IDE will ask about the login and password for that server.

The IDE will also report the result of the process once it's completed.

There are a lot of great functionalities that will significantly increase our productivity when using the IDE capabilities for control versioning. To show only a couple of them:

  • The possibility to see the differences between the current state of a file and any revision of it (or any possible combination)
  • The history of a file (when it was changed, for what reason, by who, what was the change, etc…)

 

 

 

Now I'm going to show another scenario: once we have the project in a repository, how to download it and start woking with it in another computer. This is even simpler, all it's needed it to select "Open From Version Control" from the File Menu and follow those simple steps:

  • Select the version control system

 12 - Select version control system

  • Select the destination folder

13 - Clone

  • The IDE will ask about what project to open

14 - Clone process

  • And that's all. The project is cloned to the local repository and opened in the IDE

15 - Project opened

 

As you can see, it is very easy to get the full benefits of the current most popular version control system and take profit of a free private remote repository with RAD Studio XE8. 

 

 

More usefull information in these great posts by Malcom Groves:

Git Integration in AppMethod and RAD Studio XE7

Git Integration enhancements in RAD Studio XE8