Image
{{'2017-03-20T23:25:43.7554291Z' | utcToLocalDate }}
James Duggan

Establishing a git workflow with VSTS and Visual Studio - configuring a VSTS repo from the Github sample repo

Mid-way through writing what I expected to be the second post on establishing a git workflow with VSTS and Visual Studio, I realised the second post needed to be about configuring a VSTS repo from the Github sample repo git_workflow_sample_setup, since this action will be repeated for each of the subsequent posts that will look into merge, rebase and commit squashing.

The sample code and branch structure are described in the first post Establishing a git workflow with VSTS and Visual Studio.

First of all

Throughout this post I assume the reader has some familiarity with VSTS.

When working within Visual Studio the Team Explorer Home view is key to navigation and can be returned to at any point from the Home icon. The other important icon green Manage Connections icon.

Preparing the Github sample repo

The steps detailed below are:

  1. Create the VSTS remote repo
  2. Clone the Github sample repo
  3. Update the cloned repo remotes
  4. Push the reconfigured repo to VSTS.

The end state of the prepared repo will be

  1. A master branch that is up to date with its remote
  2. A local development branch that is pending a merge down from master.

For the purposes of my next post, the Github sample repo will be cloned as git_workflow_sample_merge.

Create the VSTS remote repo

VSTS repositories are managed from version control admin. Typically the url is formed by appending _admin/_versioncontrol to the VSTS project url, for example, your.visualstudio.com/yourproject/_admin/_versioncontrol. From the version control admin page, select New repository as show below.

image

At the Create a new repository popup window enter the repo name, for example, git_workflow_sample_merge, and select Create. Ensure the Type is Git. Do not select Add a README to describe your repository, and leave Add a .gitignore as None, as these settings will impact our ability to push the cloned and reconfigured sample later.

Clone the Github sample repo

To clone git_workflow_sample_setup select the Manage Connections icon and then select Clone under Local Git Repositories as shown below.

Here I am creating the local repo as git_workflow_sample_merge. Once cloned then double-click the repository to set it as the working repo.

image

image

 

 

 

Update the cloned repo remotes

The cloned repo’s remotes must be updated to point to the new VSTS repo created earlier.

Navigate to the Home view, select Settings, then Repository Settings, and then select Edit under Remotes. The remote can then be updated to the VSTS repo as shown below.

image

image

image

 

 

 

 

Push the reconfigured repo to VSTS

The cloned and reconfigured repo is now ready to be pushed to the VSTS remote repo created earlier. Since I only want master to be up to date, it is best to first verify the master branch is selected. Navigate to the Home view and select Branches. The master branch should be highlighted as shown

image

To push to VSTS navigate to the Home view and select Sync. As shown below there are no outgoing commits and therefore push is not an available action. Instead we must sync.

imageimage

comments powered by Disqus