IntelliJ Generates a .gitignore file inside .idea folder eventhough my project already has .gitignore file in project root folder

huangapple go评论51阅读模式
英文:

IntelliJ Generates a .gitignore file inside .idea folder eventhough my project already has .gitignore file in project root folder

问题

我正在切换到使用Git管理我的项目,并通过访问gitignore.io页面并输入我的技术栈(例如,IntelliJ,Java)来生成我的.gitignore文件。

这将为IntelliJ和Java技术自动生成.gitignore文件,然后我将此文件粘贴到我的项目根目录中,如下所示:

MyProject
- .idea
- fileA
- fileB
- ...
- .gitignore

然而,我刚刚打开了我的项目,IntelliJ提示我将文件添加到.idea文件夹中。这些文件包括:

  1. .gitignore
  2. compiler.xml
  3. encodings.xml
  4. jarRepositories.xml
  5. misc.xml
  6. vcs.xml

我有两个问题:

  1. 如果我已经在项目根目录中有我的.gitignore文件,为什么IntelliJ要创建.idea/.gitignore文件?
  2. 其他文件是什么,它们是否应该被忽略?
英文:

I am switching to using Git for my projects and I generate my .gitignore file by going to gitignore.io page and entering my tech stack (for example, IntelliJ, Java).

This auto generates .gitignore file for IntelliJ and Java technologies and I paste this file in the root of my project like:

MyProject
- .idea
- fileA
- fileB
- ...
- .gitignore

However, I just opened my project and IntelliJ prompts me to add files to .idea folder. These files are:

  1. .gitignore
  2. compiler.xml
  3. encodings.xml
  4. jarRepositories.xml
  5. misc.xml
  6. vcs.xml

I have 2 questions:

  1. Why is IntelliJ creating .idea/.gitignore file if I already have my .gitignore file in my project root?
  2. What are the other files and should they be ignored?

答案1

得分: 0

我从JetBrains社区得到了这个答案,位于https://intellij-support.jetbrains.com/hc/en-us/community/posts/12550701430034-Why-is-IntelliJ-creating-a-gitignore-file-in-idea-folder-even-though-I-have-gitignore-file-in-my-project-root-and-should-it-be-ignored-or-committed-to-repository-?page=1#community_comment_12611700355346

简而言之:是的,应该将.idea/.gitignore包含在存储库中,因为它用于忽略一些内部的IntelliJ文件。

关于其他文件的信息,请参阅上面的链接。

英文:

I got answer to this from JetBrains community at https://intellij-support.jetbrains.com/hc/en-us/community/posts/12550701430034-Why-is-IntelliJ-creating-a-gitignore-file-in-idea-folder-even-though-I-have-gitignore-file-in-my-project-root-and-should-it-be-ignored-or-committed-to-repository-?page=1#community_comment_12611700355346

TLDR: Yes, the .idea/.gitignore should be included in repo as it is used for ignoring some internal IntelliJ folders.

About the other files, information is in the link above

huangapple
  • 本文由 发表于 2023年7月14日 06:50:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76683719.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定