What files in the IDEA directory should be removed

Idea contains two types of configuration information: project configuration and personal configuration. Project configuration can be shared, but personal configuration cannot. For details, please refer.

Ignore template for idea project

  • If you do not want to share the project configuration ignore file, you can write:
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

# Mac
.DS_Store
 
# Maven
log/
target/

Copy the code
  • If you want to share your project configuration, you can write Gradle and Maven with auto-import as follows:
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

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

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

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

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

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

#In addition, some IDEA plugins create configuration files in the.idea directory and ignore them if they are not shared (ex: sonarLint).
Copy the code

What if the files have already been traced

If a file is already tracked by Git, delete it from the staging area before committing it

#Remove content from the staging area
git rm -r --cached ${filePathToRemove}
Copy the code

What are some other ways to exclude files

  • Gitignore file in the root directory
  • .git\info\exclude files (project-grained, compared to.gitignore files, which are not version-tracked by Git)
  • Git global Ignore configuration (which applies to all projects

Operation method: Add the file to be deleted to the. Gitconfig configuration file

# add this to ~/.gitconfig:
#Represents the global ignore file location
[core]
    excludesfile = ~/.gitignore 
Copy the code

And create the .gitignore file in your home directory:

# create ~/.gitignore

# PhpStorm
.idea

# VSCode
.vscode
Copy the code

Is there a tool to help generate the ignore file

More ignore items can be generated using the. Ignore plugin