Home > OS >  Using existing project in a new solution and git branches in Visual Studio
Using existing project in a new solution and git branches in Visual Studio

Time:12-31

My question is what happens if I add an existing project to a Visual Studio 2019 solution which is also in a version control. What I know is that the original solution where project was created will have display all the git changes, but the new solution where the project was added to will not.

Which branch will be visible in the new solution and what happens if I checkout different branch. Would it change in the new solution as well (likely in my opinion).

Is there a way to choose the existing project branch in the new solution?

EDIT: OK so external checking out of the branch will force the existing project in the new solution "silently" to checkout to the current branch. This is of course not good as I cannot choose what branch/version is currently used. What is the best approach though I don't want to duplicate the code and I may actually need to modify the original existing project slightly (refactoring for example) which would benefit both the original and new solution. How you organize projects like this?

CodePudding user response:

I would go for git submodules. This allows you to control what branch of the newly added project you want to use. So you can do the refactoring, add new features and so on in a branch and use that. When your changes have been merged upstream you can simply switch and use the updated master branch instead.

  • Related