How to open 2 Visual Studio instances, with same Git projects and different branches

后端 未结 3 2047
北恋
北恋 2021-01-30 20:39

I am needing to open 2 Visual Studio instances, one will be opened for me to just look the code of the Project X /Branch 1. Another, will be used to code in the Project X / Bra

3条回答
  •  无人共我
    2021-01-30 21:07

    If you need to open the code in Visul Studio it is necessary to checkout the branch. As you can't checkout two different branches in the same directory at the same time, you can't avoid to checkout each branch in a separate directory.

    But you can set the remote of one directory to the other git directory, so that you can synchronize locally and don't Need to have any external.

    Assume you want to have both branches as subdirectories of a root common directory ProjectX:

    cd ProjectX
    git clone -b branch1  directory_branch1 
    git clone -b branch2 directory_branch1 directory_branch2
    

    Update May 2019: As git woorktree is now working and supported by GUI based tooling, this is probably the solution to use today.

提交回复
热议问题