Q:

Visual Studio Solution from multiple Git repositories

We have two different repositories on Git which need to come together to form the solution in Visual Studio. 
Files under each project may be from the two different repositories.  I need to make sure that when I make changes, it updates the changes in the correct repository (that is, the other repository should not perceive it at all) and also give me an option to add new files to a specific repository. 
How can this be achieved, if can be done at all? 

A:

You can use submodules to realize it.  Treat one repository as mainRepo and the other as subRepo. 

Based in the mainRepo and add the subRepo in it, use git submodule add subRepo’s_URL
Just make changes on files you want.  You don’t need to pay attention to which repository the files are from
In the local mainRepo, use git commit –a –m ‘input your comment’, and then modified files from mainRepo can be committed
In the subRepo (cd foldername), you can also use git commit –a –m ‘input your comment’, so modified files from mainRepo can be committed. 

This may be different from want you thought, but it really saves you from which is the correct repository you want to update the changes in. 
For more details about submodules, you can refer to here.