Multiple Git Repositories in your VSTS Project

Visual Studio Team Services (VSTS) offers a very useful but well-hidden feature: you can have more than one code repository per project. What seams not that interesting can help you to separate code with a different lifecycle and reduce your administrative work. Let’s have a look on how you can use this feature.

 

Create a second repository

Open the Code tab in your project and expand the menu named after your project. This opens the context menu with the option to add a new repository:

You can now specify what type of repository you want (Git or TFS), give it a name and create a .gitignore file:

From now on your newly created repository is displayed below your initial repository. To switch between them you simply click on the name:

 

Benefits

Without this little feature you would need to create a new project for every code repository. Then you would need to add users, change their permissions, create build jobs and endpoints for your deployment.

With multiple repositories you can save the administrative work. Your permissions work on all repositories, your build jobs and endpoints are the same and if a new member must be added, you only do it once.

As long as you are in the development phase this additional repository may look like overhead. But not every part of your application should be kept around forever. I used this approach for migration tools and can get rid of the whole part as soon as the switch on the new application is done. It’s also a good place to store spikes that are developed by more than one developer. I got this tip from a post by René Leupold and could save a lot of time – I hope the same will be true for your project.

 

Conclusion

The dropdown menu on the repository name is not easy to spot. But as soon as you find the options it offers is creating dedicated repositories for code with a different lifecycle a simple step. You may never need it, but when you do, it’s just a click away in VSTS.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.