英文:
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文件夹中。这些文件包括:
- .gitignore
- compiler.xml
- encodings.xml
- jarRepositories.xml
- misc.xml
- vcs.xml
我有两个问题:
- 如果我已经在项目根目录中有我的.gitignore文件,为什么IntelliJ要创建.idea/.gitignore文件?
- 其他文件是什么,它们是否应该被忽略?
英文:
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:
- .gitignore
- compiler.xml
- encodings.xml
- jarRepositories.xml
- misc.xml
- vcs.xml
I have 2 questions:
- Why is IntelliJ creating .idea/.gitignore file if I already have my .gitignore file in my project root?
- 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论