Should Eclipse-specific files in an VCS be ignored, if using Maven?

后端 未结 4 1746
轻奢々
轻奢々 2021-02-08 05:23

I know why not to commit Eclipse/IDE-specific files into a VCS like Git (which I am actually using). That is one of the reasons I am using Maven and having it generating these f

4条回答
  •  爱一瞬间的悲伤
    2021-02-08 06:02

    With the team's I've worked on, the general rule has been that you don't check in anything that is generated by or obtained by Maven. Since the pom.xml contains everything you need to create the .project, .classpath, and .settings files, we don't check them in.

    My .gitignore always contains .classpath, .settings, .project, and target for Maven projects.

    Edit: As mentioned in my comment below, here is another suggestion: If you really want to avoid having Maven or IDE specific entries in your .gitignore, try writing your .gitignore so you list only what you DO want checked in.

    *
    !stuffIDoWantToCheckIn
    

提交回复
热议问题