Beginning With Git Using VSTS

Introduction

Just like TFVC (Team Foundation Version Control), Git is another Source Version Control and it’s becoming very popular. VSTS (Visual Studio Team Services) supports both TFVC and Git. Let’s assume that you have no project or Repository and want to begin with Git on VSTS.

Create a New Project

Login to your VSTS account and click on "New Project".


Fill in the information.


Click “Create” and you will notice that the Project has been created, as shown below.



Clone it in IDE

Click “Clone in Visual Studio”. New Visual Studio IDE will start a dialog as shown below.


Provide the Repository path and click on “Clone”.

Switch to "Team Explorer" and click on “Create a new project or solution”.


When prompted, choose the project type. After Project is added successfully, you will notice that the project is added in Solution Explorer and shows (+) in front of various items and also Team Explorer’s "Changes" tab shows all the items listed as newly being added.

Commit Changes and Publish

After project is added into Solution Explorer, it’s considered as a change to the blank repository/project you created. Hence, this change needs to be added to remote Master branch.


In Team Explorer >> Changes, add a comment for check-in and click on “Commit All”.


Click “Commit All” and from the next "Synchronization" tab, click “Publish”.


Now, your Git Repository in VSTS should be updated with the code you have pushed into it. Refresh your VSTS page and you should be able to see your project code added.