Language: EN

como-uar-bitbucket-con-visual-studio

How to use Bitbucket with Visual Studio

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.

bitbucket-visual-studio-00

Once installed, we go to the Team Explorer tool window, expand the Bitbucket Extensions section, and click on login.

bitbucket-visual-studio-01

We enter our Bitbucket login details.

bitbucket-visual-studio-02

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”.

bitbucket-visual-studio-03

Next, we choose “Sync”.

bitbucket-visual-studio-04

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.

bitbucket-visual-studio-05

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.

bitbucket-visual-studio-06

We right-click on the modified file, and select “Commit”.

bitbucket-visual-studio-07

We add a comment indicating the description of the Commit.

bitbucket-visual-studio-08

The commit is created in the local Git repository. Now, to synchronize it with the remote Bitbucket repository, we click on “Sync”.

bitbucket-visual-studio-09

Now, in each function, we will have all the changes uploaded by all the authors of the project.

bitbucket-visual-studio-11

By clicking on this header, we can see all the changes made by the users.

bitbucket-visual-studio-12

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.