在两个独立的 IDE 实例中打开两个 GIT 分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30985288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open two GIT branches in two separate IDE instances?
提问by Marcus Leon
We are migrating from Mercurial to GIT.
我们正在从 Mercurial 迁移到 GIT。
With Mercurial we have separate repositories compared to one repo with separate branches in GIT.
与在 GIT 中具有单独分支的存储库相比,使用 Mercurial 我们有单独的存储库。
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?
因此,使用 Mercurial,可以直接在 IDE 的两个单独实例中打开两个单独的存储库。你怎么能用 GIT 做到这一点,因为(我相信)在 GIT 存储库中一次只有一个分支电流?
Note: this similar ticketrefers 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.
注意:这个类似的票是指在同一个 IDE 中打开两个分支。这个问题的不同之处在于我们很高兴在两个单独的 IDE 实例中打开它们。虽然我猜答案是一样的——你做不到。
回答by David Deutsch
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.
您是对的:一次只有一个活动分支。您能做的最好的事情是在本地计算机上将存储库两次克隆到两个不同的目录中,然后只需在每个 IDE 实例中打开相应的目录即可。
回答by user7610
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.
在按照 David Deutsch 的建议制作了两个克隆之后,我建议选择一个作为主要克隆,并创建一个指向 .idea 目录的符号链接,从辅助克隆到主要克隆。这样,您将在所有克隆中拥有相同的配置。
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)
这假设您使用 .idea 项目配置格式,并且您不检查存储库的配置(在这种情况下,您显然从一开始就设置好了)
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.
它大多有效,只是有时如果您更改当前活动项目中的某些设置,Idea 会通过对话框提示您重新加载其他项目。不过你可以拒绝。