來自.idea文件夾的gitignore是什麼?

本文翻譯自:What to gitignore from the .idea folder?

Possible Duplicate: 可能重複:
Intellij Idea 9/10, what folders to check into (or not check into) source control? Intellij Idea 9/10,要檢查(或不檢入)源控件的文件夾是什麼?

I started using WebStorm for web development and am not sure what to add and what to exclude from our Git repository. 我開始使用WebStorm進行Web開發,並且不確定要添加什麼以及從Git存儲庫中排除什麼。 Clearly some files inside the .idea folder are meant to be version controlled like the external library settings ( jsLibraryMappings.xml ) but others will probably change very often and are developer-specific (eg, workspace.xml ). 顯然, .idea文件夾中的某些文件應該像外部庫設置( jsLibraryMappings.xml )一樣受版本控制,但其他文件可能會經常更改並且是特定於開發人員的(例如, workspace.xml )。

What is the recommended .gitignore pattern for WebStorm / IntelliJ IDEA? WebStorm / IntelliJ IDEA的推薦.gitignore模式是什麼?

PS There are already questions about this but usually focus only on whether to include the whole .idea folder or whether to fully exclude it. PS已經存在這方面的問題,但通常只關注是否包含整個.idea文件夾或是否完全排除它。 I think some of the files inside the .idea folder should be version controlled while others shouldn't and I'm trying to find out which ones. 我認爲.idea文件夾中的一些文件應該是版本控制的,而其他文件不應該,我試圖找出哪些文件。


#1樓

參考:https://stackoom.com/question/oDYp/來自-idea文件夾的gitignore是什麼


#2樓

The official support page should answer your question. 官方支持頁面應該回答您的問題。

So in your .gitignore you might ignore the files ending with .iws , and the workspace.xml and tasks.xml files. 因此,在.gitignore中,您可能會忽略以.iws結尾的文件以及workspace.xmltasks.xml文件。


#3樓

I just want to present a more recent alternative. 我只是想提出一個更新的替代方案。 There is an online tool that generates .gitignore files based on operating systems, IDEs and programming languages that you might be using. 有一個在線工具可以根據您可能正在使用的操作系統,IDE和編程語言生成.gitignore文件。

gitignore.io gitignore.io


EDIT Disclaimer: Do not copy this file, copy the file generated by the website instead, they do a good job on keeping it updated. 編輯免責聲明:不要複製此文件,而是複製網站生成的文件,他們在保持更新方面做得很好。 This is just an example. 這只是一個例子。

The file generated for IntelliJ contains the following IntelliJ生成的文件包含以下內容

# Created by https://www.gitignore.io/api/intellij

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml

#4樓

你可以簡單地忽略所有這些:.idea / *


#5樓

https://www.gitignore.io/api/jetbrains https://www.gitignore.io/api/jetbrains

Created by https://www.gitignore.io/api/jetbrains https://www.gitignore.io/api/jetbrains創建

### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml 
# *.ipr 

#6樓

  • Remove .idea folder 刪除.idea文件夾

     $rm -R .idea/ 
  • Add rule 添加規則

     $echo ".idea/*" >> .gitignore 
  • Commit .gitignore file 提交.gitignore文件

     $git commit -am "remove .idea" 
  • Next commit will be ok 下次提交就可以了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章