从 IDE 外部进行版本控制是一种好习惯吗?

2022-01-16 00:00:00 git intellij-idea eclipse-plugin eclipse

我不止一次从同行那里听说这是建议"的.不要在编写代码的 IDE 中对代码进行版本控制.我见过他们在 Eclipse, IntelliJ IDEA 等,但从命令行或独立客户端进行版本控制(在我当前的场景中 - Git)而不是使用相应的插件可用于 IDE.

I have heard from my peers on more than one occasion that it is "advised" not to do version controlling of your code from within the IDE where you write it. I have seen them developing on Eclipse, IntelliJ IDEA, etc. but doing version control (in my current scenario - Git) from command-line or standalone clients as opposed to using the corresponding plugins readily available for the IDE.

虽然我在 Eclipse 中使用过版本控制插件并且从未发现任何问题,但我想知道一般规范是什么以及为什么?

Though I have used version control plugins in Eclipse and never found any issues, I would like to know what is the general norm and why?

推荐答案

我不认为有一个普遍的规范.这个问题的答案非常主观.

I don't think that there's a general norm. The answer to the question is highly subjective.

我个人不使用任何 IDE 集成(甚至没有 GUI 工具,除了内置的 git guigitk),因为我的经验告诉我这些工具行为不同于命令行版本和/或不提供命令行上可用的全部功能:

I personally don't use any IDE integration (not even a GUI tool, except the builtin ones git gui and gitk) because my experience told me that these tools behave different than the command line version and/or don't provide the full functionality available on the command line:

  • NetBeans 是否忽略我的 Git pre-提交钩子?
  • 你能使用 TortoiseGit 与索引/暂存区交互?
  • TortoiseGit 真的像 TortoiseSVN 一样让 Git 更容易使用吗?

另一件事是,您对版本控制工具的了解与您的 IDE 密切相关.除了使用 Eclipse 编辑的源(例如,您的点文件)之外,您可能还想为其他内容设置一些版本管理.

Another thing is that your knowledge about your versioning tools is bound to your IDE. Maybe you want to set up some version management for other things than the sources you edit with Eclipse (your dotfiles, for example).

或者有一天您切换 IDE,放弃 Eclipse 并开始使用 Visual Studio.那么你不仅要学习Visual Studio,还需要学习VS中的Git集成.

Or one day you switch your IDE, drop Eclipse and start using Visual Studio. Then you don't have to learn only Visual Studio but in addition you need to learn the Git integration in VS too.

我认为与我上面所写的内容相比,在 IDE 内部合法使用版本控制工具并没有明显的优势.

I think compared with what I've written above, there are no serious advantages that would legitimate the usage of version control tools from inside the IDE.

所以,IMO,从内部IDE进行版本控制是一种不好的做法,并且应该始终从外面.

So, IMO, it's a bad practice to do version control from inside the IDE and it should always be done from the outside.

相关文章