Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What project files are supposed to ignore in '.gitignore' file?

I have created my first git repository and trying to put Spring Boot project.

In the initial git asked to configure ".gitignore" file but i was not sure what files must (supposed to) be in, so i ignored ?

In my first commit-push, i see several files APART FROM pom.xml and some of my .java files like,

.classpath
.gitignore
.project
.settings/org.eclipse.core.resources.prefs
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.m2e.core.prefs

And i am not sure why they are here ?
are they supposed to be there ?

How and where to create .gitignore file ?

like image 563
user252514 Avatar asked Jun 20 '17 15:06

user252514


People also ask

What files to ignore in Gitignore?

Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are: dependency caches, such as the contents of /node_modules or /packages. compiled code, such as .o , .pyc , and .class files.

What file should I put in a Gitignore?

gitignore should list the names or name-patterns of files that will be found in work-trees when working with your project, but that should not be committed to the project. In other words, it's not OS-specific, it's project-specific.

Why files in Gitignore are not ignored?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.


1 Answers

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.

like image 152
miwoe Avatar answered Oct 01 '22 17:10

miwoe