usr-local-ΕΨΗΕΛΩΝ
usr-local-ΕΨΗΕΛΩΝ

Reputation: 26874

Why IDE-specific project files are ignored in Git?

I have seen that a number of projects posted on Github feature a .gitignore file explicitly excluding control files related to the IDE. These control files are widely used to define the project and its dependencies. These can be .sln for .NET or .project for Eclipse.

I want to ask why is this practice widely applied or considered a good practice, considering that I agree that achieving IDE-neutrality (don't bind developers to a specific IDE) is a good principle, in general.

On the contrary, these control files often dictate project dependencies, configuration or compilation variables in multiple configurations (this is the case of the .csproj files for example).

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

If the project files were present in repositories it would be vry simple to set up a development environment with "download the code, import the project and voilà compile the source" but it would obviously bind developer to a specific IDE (and that's not funny).

Standardizing or migrating project files is out of the scope of the question.

So, from an external contributor's point of view, how does one build up a working and compiling project environment for a project of which he downloaded the source code from Github? (after cloning all submodules, if needed)

Just to pick one example project I would like to import into Eclipse, analyse and slightly modify, here it is.

Upvotes: 4

Views: 1579

Answers (3)

Hiery Nomus
Hiery Nomus

Reputation: 17769

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

Furthermore in a mixed team, where different people use different IDE's, when somebody updates the Eclipse project files, the guy using IntelliJ suddenly also needs to update his project files, as he now gets compilation problems. Whereas using a build system that generates these files, ensures that they're always up-to-date. Using Maven for instance this is even done without user interaction when you add the M2Eclipse plugin to Eclipse or use IntelliJ.

So I always advocate to add the project files to .gitignore...

Upvotes: 2

Christoph
Christoph

Reputation: 27995

Notice that csproj files are not IDE specific but instead form the basic project structure and build steps of a .NET project. Even if you switch to a completely diffferent IDE like SharpDevelop you still need them to get the project running. So, in general those shouldn't be on the .gitignore file. Only the things that are user or IDE specific should be excluded.

Upvotes: 7

Mihai Maruseac
Mihai Maruseac

Reputation: 21435

Because some people don't use those IDEs while others have some tweaks made to their configurations. Not to mention the fact that those IDE specific files change too quickly and too uselessly after each compile step.

The best is to have Makefiles, Ant files or other equivalent build systems in place, instead of relying on IDE files.

Of course, some of the errors are caused by missing libraries. You'll have to install them by yourself, having IDE files in repo or not doesn't matter.

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

Upvotes: 2

Related Questions