简体   繁体   中英

How to use multiple Git repositories in Visual Studio 2017

My solution involves three Git repositories in a self-hosted Bitbucket Server. One repository for the iOS project, one repository for the shared project type such as libraries shared among other projects like Android, and then the company shared repository with more class libraries not project specific.

In Visual Studio 2015 I could go to the Team Explorer and connect to the various repositories, so I could view the commit history and have source control access to commit or pull from Git. In Visual Studio 2017 when I connect to one of the other repositories I am taken out of my solution back to the start page.

How can I manage multiple repositories that make up one Visual Studio 2017 solution? My only option right now is using an external tool such as Sourcetree .

The design for Team Explorer has always been to close the solution if the containing Git repository was closed and a different repository was opened. If you were seeing different behavior in Visual Studio 2015, it was unintentional.

We would like to support multiple Git repositories open at the same time in Team Explorer, but that feature has not yet been added.

The Team Explorer extension provides the Git integration for Visual Studio. Regardless of whether you use VSTS or not, you'll still use Team Explorer for Git operations in the IDE. I completely agree that it would be great to support multiple repositories for a single solution. Features are prioritized and this one simply hasn't been built yet.

This is currently still unsupported so you will have to drop out to the command line or open multiple instances of Visual Studio.

However, support for this feature has been reported as "planned" and you can vote to increase the priority of this feature on the Visual Studio User Voice site .

Both Visual Studio 2015 and Visual Studio 2017 will close a solution if you switch to another Git repository. But you can open three Visual Studio windows to handle these three git repositories at the same time.

Assume the three Git repositories located in D:\Dev\git1 , D:\Dev\git2 and D:\Dev\git3 , and Visual Studio (works both for Visual Studio 2015 and Visual Studio 2017) is connect with D:\Dev\git1 .

You can connect git2 by opening the folder D:\Dev\git2 in Windows Explorer , and open.sln file in D:\Dev\git2 by the same version of Visual Studio, and then Visual Studio will connect with D:\Dev\git2 in another Visual Studio window. You can connect with D:\Dev\git3 by the same way. And you will find three Visual Studio windows opened to connect with the three Git repositories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM