Source code control is an indispensable tool for any developer. In this post, we will see how to configure Bitbucket with Visual Studio.
In today’s times, it is difficult to imagine working without source code control even in personal projects, and practically impossible in team projects.
There is a wide variety of alternatives for source code control. From Visual Studio Team, the most common in Microsoft systems, in its Foundatin (self-hosted) or Services (cloud) versions. To the well-known Github, widely used in Open Source projects.
In its free version, Teams Services allows an unlimited number of private repositories in teams of up to 5 people. While the free version of Github only allows public repositories.
In this post, we will see another widely known alternative, Bitbucket, an online service from the company Atlassian. Like Teams Services, the free version allows unlimited private repositories and teams of up to 5 members.
In certain situations, it is preferable to use Bitbucket over Teams Services. For example, in the case that a team member uses an unsupported IDE, or that the team prefers the way Bitbucket is used.
In any case, using Bitbucket with Visual Studio as source code control is very simple and the integration is almost perfect, as we will see below.
Install Bitbucket with Visual Studio
The latest versions of Visual Studio incorporate compatibility with Git, so it is basically compatible with Bitbucket. We only need to install an extension that simplifies the process.
So, we search for and install the Visual Studio Bitbucket Extensions extension.
Once installed, we go to the Team Explorer tool window, expand the Bitbucket Extensions section, and click on login.
We enter our Bitbucket login details.
That’s it, we have now configured Visual Studio with Bitbucket. Now we will see how to work with it.
Use Bitbucket with Visual Studio
Let’s try using Bitbucket. We open any existing project, or create one for testing. Right-click on it and choose “Add Solution to Source Control”.
Next, we choose “Sync”.
Since this is the first time we are synchronizing the project, it will ask us to create a repository. The name should contain only lowercase letters, no spaces.
A local Git repository will be created, and it will be synchronized with the newly created remote repository in BitBucket.
Testing Bitbucket with Visual Studio
Let’s test using Bitbucket. For example, we write a comment in any file of our project.
We right-click on the modified file, and select “Commit”.
We add a comment indicating the description of the Commit.
The commit is created in the local Git repository. Now, to synchronize it with the remote Bitbucket repository, we click on “Sync”.
Now, in each function, we will have all the changes uploaded by all the authors of the project.
By clicking on this header, we can see all the changes made by the users.
Of course, we have all the usual functions in Git repositories (retrieve any version, compare versions, branch, merge).
That’s it. Using Bitbucket with Visual Studio is a good alternative to Github or even Teams Services as source code control, and we can use it in our projects or in small teams.