设为首页 加入收藏

TOP

Java 开发 .gitignore 文件包含 .iml,.log 的看法
2018-02-26 08:40:10 】 浏览:162
Tags:Java 开发 .gitignore 文件 包含 .iml .log 看法

有一个开源项目https://github.com/github/gitignore 主要用来规范所有开发项目的.gitignore文件的编写,基本涵盖了所有的开发语言、开发环境等。今日我向JetBrains.gitignore提交了一个pull request,希望能在这个文件中增加.iml、.log两行代码的支持,引起了一场讨论。提交的pull request为:https://github.com/github/gitignore/pull/2418 。

而JetBrains官方也对相关文件是否应该加到.gitignore中给出了意见,官方建议在此:https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 。官方的一些解释如下:

This format is used by all the recent IDE versions by default. Here is what you need to share:
All the files under .idea directory in the project root except the workspace.xml andtasks.xml files which store user specific settings

.idea目录中除了workspace.xml和tasks.xml不需要在开发者之间共享,因为这两个文件保存了用户特定的信息。其他的都应该共享。所以workspace.xml和tasks.xml可以写到.gitignore中,其他的不要写到.gitignore中。

All the .iml module files that can be located in different module directories(applies to IntelliJ IDEA)

所有的.iml文件都应该共享,因为这些文件定位了不同的module目录。

You may consider not to share the following:

.iml files for the Gradle or Maven based projects, since these files will be generated on import

一些基于Gradle、Maven的项目中的.iml文件,因为这些文件会在import的时候生成。

gradle.xml file, see this discussion

gradle.xml文件也不应该被分享。

user dictionaries folder (to avoid conflicts if other developer has the same name)

用户的目录文件夹也不应该被分享。

XML files under .idea/libraries in case they are generated from Gradle or Maven project

.idea/libraries目录下的XML文件也不应该分享,因为它们是由gradle、maven生成的。

其实看了官方的关于.iml的说明,我还是不明白到底是否应该把.iml添加到.gitignore中,感觉官方的解释比较模糊。在有些评论中,开发者建议对于一些文件,可以设置一个local目录,在local目录中的文件是不需要被分享的。各位客官怎么看呢?

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇编辑 Spring Converter 入门之字.. 下一篇通向架构师的道路(第十二天)之A..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目