Why are IDE-specific project files being ignored in Git?

I've seen a number of projects posted on Github have a file .gitignore

explicitly excluding IDE related control files. These control files are widely used to define a project and its dependencies. They can be .sln

for .NET or .project

for Eclipse.

I want to ask why this practice is widely adopted or considered good practice given that I agree that achieving IDE neutrality (not tying developers to a specific IDE) is a good general principle.

In contrast, these control files often set project, configuration, or compilation dependency options across multiple configurations (for example, in the case of files .csproj

).

I have seen a large number of open source projects ignoring Eclipse files, however, until now it was impossible for me to set up a development environment without project files (even if I create a project from existing code or create a new project and import the code, I always get the pros of compilation errors ).

If the project files were present in the repositories it would be easy to set up a development environment with "load code, import project and change voilà source", but it will obviously link the developer to a specific IDE (and that's not funny).

Standardizing or migrating project files is out of scope.

So, from the point of view of an external contributor, how to create a working and compiled project environment for the project from which he downloaded the source from Github? (after cloning all submodules if needed)

Just select the project one that I would like to import into Eclipse, analyze and slightly modify, here it is.

+3


source to share


3 answers


With quite a few build systems in the Java world (Maven, Gradle, SBT, etc.). This is a piece of cake for creating project files for your IDE. This makes it unnecessary to check them in version control as they can be considered a build artifact.

Also, on a mixed team where different people use different IDEs, when someone updates the Eclipse project files, the guy using IntelliJ suddenly needs to update his project files as well, as he is now having compilation problems. Whereas, using a build system that generates these files ensures that they are always up to date. For example, using Maven is done even without user interaction when you add the M2Eclipse plugin to Eclipse or use IntelliJ.



Therefore, I always recommend adding the project files to .gitignore

...

+1


source


Note that the csproj

files do not have an IDE, but instead form the basic project structure and follow the project steps .NET

. Even if you switch to a completely different IDE like SharpDevelop, you still need the project to work. So in general it shouldn't be in the file .gitignore

. Only those things that are user or IDE specific should be excluded.



+6


source


Because some people don't use these IDEs and others have some settings made for their configurations. Not to mention, certain IDE files change too quickly and too useless after each compilation step.

It's best to have Makefiles, Ant, or other equivalent build systems instead of relying on IDE files.

Of course, some of the errors are caused by missing libraries. You will have to install them yourself, with the IDE files in repo mode or irrelevant.

What I usually do: clone the project, create a build script, if it doesn't exist, add it to .git/info/exclude

as it will be machine specific.

+1


source







All Articles