What project files are supposed to be ignored in '.gitignore' file? (Spring Boot)

Solution 1:

Have a look into https://www.gitignore.io/ There you can create your recommended gitignore based on what you are using.

For Eclipse it says:

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

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Eclipse Patch ###
# Eclipse Core      
.project

# JDT-specific (Eclipse Java Development Tools)     
.classpath

# End of https://www.gitignore.io/api/eclipse

I had many discussions in teams whether to put IDE based files in GIT or not. Some like it, some say every developer knows how to configure their IDE for the project based on the pom.xml.

My opinion now also is, keep away all IDE files from VCS.

Solution 2:

The .classpath file, .project file, and .settings/ directory are used by the Eclipse IDE.

There are differing opinions about putting IDE-specific project files under source control. I prefer to exclude them (and let the IDE generate its project files from the pom, provided it has decent Maven integration - which eclipse does) because I've seen sharing them to cause more problems than it solves. Other people will probably tell you they should all be included, and I'll leave it to them to justify their reasons for that; point is, I don't believe there's a single definitive consensus on this.

The .gitignore file contains ignore rules. It specifically contains rules that are meant to be shared through the repository, so it should be included. (If you have ignore rules that you don't mean to share through the repository, there are other files where those would be defined; see the git ignore docs.)