Open two GIT branches in two separate IDE instances?
Solution 1
You are correct: there is only one active branch at a time. The best you can do is to clone the repository twice on your local machine into two different directories, and then simply open up the appropriate directory in each IDE instance.
Solution 2
After making the two clones as David Deutsch suggested, I recommend picking one as primary and creating a symbolic link to the .idea directory from the secondary clone to the primary clone. This way you will have the same config in all clones.
ln -s primary_clone/.idea secondary_clone/.idea
This assumes you use the .idea project config format and that you do not check config to the repository (in that case you are obviously all set from the get go)
it mostly works, only sometimes Idea prompts you with dialog box to reload other projects if you change some setting in the currently active one. You can refuse, though.
Related videos on Youtube
![Marcus Leon](https://i.stack.imgur.com/Xk75m.jpg?s=256&g=1)
Marcus Leon
Director Clearing Technology, Intercontinental Exchange. Develop the clearing systems that power ICE/NYSE's derivatives markets.
Updated on July 09, 2022Comments
-
Marcus Leon almost 2 years
We are migrating from Mercurial to GIT.
With Mercurial we have separate repositories compared to one repo with separate branches in GIT.
Thus with Mercurial it's straightforward to open two separate repos in two separate instances of your IDE. How can you do this with GIT as there is (I believe) only one branch current at a time in a GIT repo?
Note: this similar ticket refers to opening two branches in the same IDE. The difference with this question is we're happy to open them in two separate IDE instances. Though I'm guessing the answer is the same - you can't do it.
-
Ali Karaca over 5 yearsPossible duplicate of How to open 2 Visual Studio instances, with same Git projects and different branches
-
S K over 5 years
-
SherylHohman over 3 yearsIt is possible, using
git-worktree
: "Manage multiple working trees". Docs at: git-scm.com/docs/git-worktree. Some related SO links, mentioning worktree as a solution: How to open 2 Visual Studio instances, with same Git projects and different branches, and Multiple working directories with Git?. -
SherylHohman over 3 yearsOh...these SO links are the same links that the above two comments suggested. Well, the Docs link is new, and title of the second link is now visible.
-
-
Ionian316 about 6 yearsGreat idea. In Windows you would use the mklink command like this:
mklink /J "C:\Clone\.idea" "C:\Original\.idea"
-
bluelurker about 3 yearsBeware that running maven install from any of these 2 instances will deploy the application in the same local repository unless specified explicitly. It will overwrite the previous deployment.
-
Mateusz Niedbal over 2 yearsIs there any resolve for that problem in the new IDE updates?
-
David Deutsch over 2 years@MateuszNiedbal - no, as this has nothing to do with the IDE itself. Rather, it is the fact that each working directory has one and only one active branch at a time.
-
Mateusz Niedbal over 2 yearsI see, thanks. Seems to be reasonable.