从Mercurial版本控制中包含/排除IDE特定的配置文件 [英] Include/exclude IDE-specific configuration files from Mercurial version control

查看:131
本文介绍了从Mercurial版本控制中包含/排除IDE特定的配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ 2017.2 IDE 自己的配置文件(workspace.xmltasks.xml文件除外).我可以理解其中的含义,因为我可能会错误地配置项目设置并想要还原.

The IntelliJ 2017.2 documentation suggests including the .idea folder that contains that IDE’s own configuration files (excepting the workspace.xml and tasks.xml files). I can understand the sense in this, as I could incorrectly configure the project settings and want to revert.

但是,我想将此开源多模块Maven驱动的项目发布到BitBucket上以供公众访问.显然,并不是每个人都将IntelliJ用作他们的 IDE ,所以我不想强加我的IDE设置在他们身上.

Yet, I want to post this open-source multi-module Maven-driven project to BitBucket for public access. Obviously, not everybody uses IntelliJ as their IDE, so I do not want to force my IDE settings on them.

➠开源作者如何解决这个难题?

➠ How do open-source authors resolve this conundrum?

推荐答案

我的经验建议是始终显式忽略(即添加到.hgignore.gitignore中)IDE配置文件或目录.

My suggestion that comes from experience is to always explicitly ignore (that is, add to .hgignore or .gitignore) IDE configuration files or directories.

不使用特定IDE的配置文件对项目进行垃圾邮件处理不仅是一个问题.当更多的人使用同一IDE时,真正的问题就开始了.根据IDE及其配置方式的不同,您可能会遇到以下情况:每次提交都包含对这些文件的更改,并且会使使用同一IDE的所有其他开发人员感到困惑,从而又会无限循环地覆盖更改.

It is not only a question of not spamming a project with configuration files for a specific IDE. The real problem begins when more that one person uses the same IDE. Depending on the IDE and on how it is configured, you can fall in a situation where each commit contains changes to these files, and will confuse all the other developer using the same IDE, which in turn will overwrite the changes again in a infinite loop.

您的某些IDE设置将是全局设置,并存储在您的主目录中.只要您不更改克隆存储库的本地目录,那些特定于项目的目录将继续存在.如果您更改目录,以我的经验,总是可以重新配置IDE.更改本地目录至少有两种情况:(1)删除目录并再次克隆存储库(2)使用多台计算机.

Some of your IDE settings will be global and stored in your home directory. The ones that are project specific will survive as long as you don't change the local directory in which you cloned the repo. If you change directory, in my experience it is always tolerable to reconfigure the IDE. There are at least two situations when the local directory changes: (1) you remove the directory and clone the repository again (2) you use more than one computer.

如果您担心编码风格之类的问题,那么最好的方法是使用适用于任何编辑器或IDE的命令行格式化工具.该工具将在回购中提交其配置文件,因为编码风格对于回购的所有开发人员和文件应该是相同的.

If you are concerned for things like coding style, then the best approach is to use a command-line formatter tool that works for any editor or IDE. That tool will have its configuration file committed in the repo, since coding style is something that should be equal for all developers and files of a repo.

这篇关于从Mercurial版本控制中包含/排除IDE特定的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆